matlab-figure

UIAxes' YLim property cannot be listened to

 ̄綄美尐妖づ 提交于 2019-11-30 22:53:53
MATLAB provides the addlistener function. Listeners allow us to keep track of changes of an object's properties and act upon them. For example, we can create a very simple listener that will display a message in the command window when the 'YLim' property of an axes object is changed: % Example using axes ax = axes(); addlistener(ax, 'YLim', 'PostSet', @(src, evnt)disp('YLim changed')); Try panning the axes or zooming in/out and see what happens. This works fine. I need to do the same but using an uiaxes instead. Unfortunately, it looks like we are not allowed to do so. Try running the

Modify x-axis position

丶灬走出姿态 提交于 2019-11-30 22:13:02
When you use plot function in Matlab, you are presented with y and x axis on the left and at the bottom respectively. But I'd like the x-axis to strike through in the middle of the figure with the scales and numbers like so: I beg a pardon for my amateur paint skills. But basically I want the x-axis to move to the top for example and I want to have numbers there and those small bumps like indicated on the red line but all the way through to the right, but I do not want a number under each "bump" just the whole numbers. I tried to google the answer but couldn't find anything. Clearly, I do not

How To Put String Labels on Contours for Contour Plots in MATLAB

╄→尐↘猪︶ㄣ 提交于 2019-11-30 20:57:31
I am wondering if it is possible to label the contours of a MATLAB contour plot with a set of user-defined strings? I am currently using the following code snipper to produce a labelled contour plot: %Create Data X = 0.01:0.01:0.10 Y = 0.01:0.01:0.10 Z = repmat(X.^2,length(X),1) + repmat(Y.^2,length(Y),1)'; %Create Plot hold on [C,h] = contourf(X,Y,Z); %Add + Format Labels to Plot hcl = clabel(C,h,'FontSize',10,'Color','k','Rotation',0); set(hcl,'BackgroundColor',[1 1 1],'EdgeColor',[0 0 0],'LineStyle','-',) hold off The issue with this code is that the labels are automatically generated by

How to draw good looking arrows in Matlab?

十年热恋 提交于 2019-11-30 20:27:57
I have been trying to draw arrows in Matlab in my figure but they all look terrible. Also, I want my arrowhead to be a solid triangle, not a V. I tried using the packages available on the Matlab File Exchange: arrow, arrows, arrows3, and probably at least one other one. I even tried manually creating an arrow in the Matlab figure editor, but when I adjust the line width, the arrow looks like this: I used the annotation command to create the arrow above: annotation(gcf,'arrow',[0.621875 0.457916666666667],... [0.205421152030217 0.40755429650614],... 'HeadLength',4,'LineWidth',5); Here's the

presenting motion of random walkers in matlab

大兔子大兔子 提交于 2019-11-30 19:27:15
问题 I have simulated some random walkers. I used plot(xb,yb,'b--o') to show particles in each step. I saw a code in below link with beautiful particles with tail which moves in a blur way. Is there a way which I could my random walkers the same as the walkers in the link in mat lab? Could anyone tell me which should I use instead of the plot function I used? beautiful particles The code I tried: clear all close all lbox=20; %random fluctuation eta = (2.*pi).*.1; vs=0.02; n=200; birdl=[1:n]; axis(

Saving figure with current file name in MatLab

喜夏-厌秋 提交于 2019-11-30 18:48:13
问题 I have a script that pulls one file at a time from my current working directory and plots specified information. I would like to save each of the plots as a jpeg (tiff is okay too) with the name of the file it's plotting. I have about 3000 files, so I am looking for an automated way to do this. I thought this might work if placed at the end of the for-loop: saveas(gcf, ' ',jpg) I am not sure what to put in quotations for the file name. Example The plot of the data in data1.mat should be saved

Have Matlab figures docked by default

删除回忆录丶 提交于 2019-11-30 18:10:12
In Matlab, it is possible to have figure windows docked in the main window. If there are several figures, each of them appears in a different "tab". Is it possible to set up the system so that all figure windows will be created docked by default? To dock figures by default , try calling: set(0,'DefaultFigureWindowStyle','docked') at the beginning The point 'n' click alternative: Click Desktop -> Figures . Click the arrow underneath the cross in the top-right (tooltip is 'Dock Figures'). Save your desktop layout with Desktop -> Save Layout... 来源: https://stackoverflow.com/questions/6911176/have

How do I add two legends to a single plot in MATLAB?

别来无恙 提交于 2019-11-30 14:01:21
I'd like to add two legends to a plot in MATLAB. How can I do this? You could create a second superimposed axis, with a legend of its own (in a different location of course). EDIT: Here is a quick example: %# create some plot with a legend hAx(1) = axes(); hLine(1) = plot(1:10, 'Parent',hAx(1)); set(hAx(1), 'Box','off') legend(hLine(1), 'line') %# copy the axis hAx(2) = copyobj(hAx(1),gcf); delete( get(hAx(2),'Children') ) %# delete its children hLine(2) = plot(sin(1:10), 'Color','r', 'Parent',hAx(2)); set(hAx(2), 'Color','none', 'XTick',[], ... 'YAxisLocation','right', 'Box','off') %# make it

Disable plots in Matlab

僤鯓⒐⒋嵵緔 提交于 2019-11-30 12:10:11
I have some programs written in Matlab that I need to run several times for some reasons (debugging, testing with different input, etc...) But, there are a lot's of graphs that are plotted by the programs and its various functions such that everytime I run the program, I have to wait for all the graphs to be displayed, which is very annoying and time consuming (especially when you are working with a small laptop). After the program is executed, I close them with a close all . So my question is: Is there a way to disable all plots/figures/graphs in Matlab? either in the options, or by executing

Matlab - implay's default size window

给你一囗甜甜゛ 提交于 2019-11-30 10:10:24
I am using implay to play some frames i want, the thing is that window size that pops is a bit small,so the user must maximize it by himself, is there any way to control the size of the window that pops up? Ah here we go: implay(Diff); set(findall(0,'tag','spcui_scope_framework'),'position',[150 150 700 550]); Works in 2012b. (Note: if you have more than one implay window open, this will set them all to the same size) So you can learn how to find this kind of stuff for yourself, what I did was start with a workspace with no other open windows. I then used implay(Diff) to open an implay window.