matlab-figure

UIAxes' YLim property cannot be listened to

為{幸葍}努か 提交于 2019-12-03 21:23:35
问题 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

How to save MATLAB figure as JPEG using saveas() without the image coming off badly?

孤街浪徒 提交于 2019-12-03 19:11:00
问题 In a MATLAB function I am writing, I am generating a figure. The figure is displayed when the function is executed. I need to save the figure as a JPEG image. To do that, I could do File->Save As in the figure window that displays the figure. But I'd like to automate this. I've tried to do that using the saveas() function. The problem is that the resulting image is undesirable. Here are the images for a demo problem to show you what I mean: JPEG image saved manually using File->Save As in the

Plotting issues with dash-dot and dotted lines: How to modify default linestyles for better use with vector renderer 'painters'?

北城以北 提交于 2019-12-03 16:25:27
Matlab offers the following default linestyles : '-' Solid line (default) '--' Dashed line ':' Dotted line '-.' Dash-dot line The first two are alright, the third : is absolutely not my taste and rendered badly and the last one -. is just usable with pixel renderers ( openGL , zbuffer ), otherwise it looks the same as -- . But I'd like to render my graphs with painters for countless reasons. This way the dash-dot line becomes useless: The dash-dot lines (blue, bright red) practically look the same like the dashed line (dark red). This is a 3000% zoom of my vector-graphic based PDF. This is

Switching values to plot using keyboard input

ε祈祈猫儿з 提交于 2019-12-03 13:36:44
问题 I have sets of data in a matrix. I want to plot on set and then use a keyboard input to move to another one. It's simply possible this way: for t=1:N plot(data(:,t)) pause end but I want to move forward and backward in time t (e.g. using arrows). OK, it could be done like this: direction = input('Forward or backward?','s') if direction=='forward' plot(data(:,ii+1)) else plot(data(:,ii-1)) end but isn't there something more elegant? (On one click without getting the figure of the sight - it's

Replace quiver arrowheads with images

戏子无情 提交于 2019-12-03 12:40:29
问题 I have a circular lattice and on the lattice sites I plot normalized arrows that remain in the same magnitude and change direction according to a simulation, the details of which don't matter. My plots look like this Is it possible to replace the arrow in the quiver plot by an jpg/bmp/gif/png image? or by any other command? Ideally, it would look something like this (although not necessarily arrows) 回答1: Explanation One way that you can do this, would be to use a surface object with a texture

Get rid of “Figure 1” in the title of the figure

≯℡__Kan透↙ 提交于 2019-12-03 10:35:23
I have a figure that I want his name to be Step 2 of 3: Simulation Plot Window , but its name is: figure 2: Step 2 of 3: Simulation Plot Window . How can I change his name to the name I want? I don't know if it's necessary, but in the start of the code I wrote: hFig = figure('Name','window 1','Visible','Off'); and Towards my code ends, I write: hFig = figure('Name','Step 2 of 3: Simulation Plot Window','Menubar','none', 'Resize','off', ... 'WindowStyle','modal', 'Position',[300 300 1150 600]); Showing the number in the title is one of the properties of the figure. By default it is set to on ,

Saving graph produced in MATLAB maximized to fullscreen

允我心安 提交于 2019-12-03 09:43:07
I am producing graphs in MATLAB using the following command saveas(gcf, 'save.jpg']) . However the image that is saved is small. I would like to maximize the graph produced and save the maximized graph. Is this possible? Lucas Holt I have looked for this solution for a very a long time, and believe I have found it. The run-time requirements to save the maximized graph seem to be larger than normal because the resolution and image size must be transformed... just something to be aware of. figure('units','normalized','outerposition',[0 0 1 1]); set(gcf, 'PaperPositionMode', 'auto'); the first

How can I create a slice of a surface plot to create a line? (Matlab)

纵饮孤独 提交于 2019-12-03 08:52:47
Given some function z = f(x,y), I'm interested in creating a (1D) line plot along an arbitrary cutting plane in x,y,z. How do I do this in Matlab? Slice, for example, provides a higher dimensional version (colormap of density data) but this is not what I'm looking for. E.g.: z = peaks(50); surf(z); %->plot z along some defined plane in x,y,z... This has been asked before, e.g. here , but this is the answer given is for reducing 3D data to 2D data, and there is no obvious answer on googling. Thanks. If the normal vector of the plane you want to slice your surface will always lay in the xy plane

is it possible to speed-up matlab plotting by calling c / c++ code in matlab?

和自甴很熟 提交于 2019-12-03 05:59:28
问题 It is generally very easy to call mex files (written in c/c++) in Matlab to speed up certain calculations. In my experience however, the true bottleneck in Matlab is data plotting. Creating handles is extremely expensive and even if you only update handle data (e.g., XData, YData, ZData), this might take ages. Even worse, since Matlab is a single threaded program, it is impossible to update multiple plots at the same time. Therefore my question : Is it possible to write a Matlab GUI and call

Switching values to plot using keyboard input

限于喜欢 提交于 2019-12-03 04:41:26
I have sets of data in a matrix. I want to plot on set and then use a keyboard input to move to another one. It's simply possible this way: for t=1:N plot(data(:,t)) pause end but I want to move forward and backward in time t (e.g. using arrows). OK, it could be done like this: direction = input('Forward or backward?','s') if direction=='forward' plot(data(:,ii+1)) else plot(data(:,ii-1)) end but isn't there something more elegant? (On one click without getting the figure of the sight - it's a big full sreen figure.) You can use mouse clicks combined with ginput . What you can do is put your