matlab-figure

Avoid saving of graphics in Matlab

五迷三道 提交于 2019-12-10 20:58:45
问题 Starting R2014b Matlab has changed the way how variables are saved using save command; Matlab has also changed the way graphic handles are saved, they are saved as structures now. If you have graphic handles in workspace Matlab takes it longer to save the mat file, size of mat file is large and when you load the file all the saved figures are popped-up, which is irritating to me. It also produces a warning: Warning: Figure is saved in Oakley_19_PDEparameterEstimation.mat. Saving graphics

How can I show partially colored text in Matlab?

◇◆丶佛笑我妖孽 提交于 2019-12-10 20:57:49
问题 I am trying to color some alphabets in a string based on input alphabet given. Can anyone suggest me how to achieve it ? As I am new to this. Suppose that I have the following string: "AUSTRALIA" INPUT : A OUTPUT : (A in red)'A'USTR(A in red)'A'LI(A in red)'A' 回答1: If you want to show it as text on axes (GUI), use the text command and Latex formatted strings text('string','{\color{red} A}ustralia') You can read about Latex commands here. Alternatively, there is an undocumented functionality

Matlab: How to change the linewidth in a figure before actually plotting some?

流过昼夜 提交于 2019-12-10 18:34:33
问题 This question maybe a bit like the link below, but this didn't work for me... http://nl.mathworks.com/matlabcentral/answers/102530-how-can-i-change-the-default-settings-for-the-linewidth-property-before-i-plot-a-figure-in-matlab I'm working on a matlab function that automatically opens your figure in full screen mode and on a second monitor if present. So far, everything works fine. I already achieved to set the fontsize inside the function, so whitout plotting anything and without making

How to change display format of legend in MATLAB

瘦欲@ 提交于 2019-12-10 17:54:33
问题 I am looking for a way to force the legend entries in a particular format. I following code, they are displayed like Instead I want it like 1e-1,1e-2,1e-3,1e-4, 1e-5. Is there a way to do this. MWE: sig=[0.1 0.01 0.001 0.0001 0.00001]; for j=1:length(sig) for x=1:10 Cost(j,x) = 2*x+j; end plot(1:10,Cost(j,:)); end legend(strcat('\sigma^2_n=',num2str((sig)'))); set(h,'Interpreter','latex') 回答1: You should specify that you'd like to use scientific notation when you convert sig to a string by

Swapping x & y Axis in Matlab

感情迁移 提交于 2019-12-10 16:44:35
问题 Potentially easy matlab question here, but I've searched and can't sort out how to do this. I've got a variables, which plot like this: I simple want the x axis to be the y axis and vice versa. How do I swap them? Thank you in advance for your help!! 回答1: The standard way would be to swap the arguments passed to plot : plot(ydata, xdata) %// instead of plot(xdata, ydata) Failing that, you can change the view to rotate the axes: view([90 -90]) %// instead of normal view, which is view([0 90])

Setting a title for a legend in Matlab

核能气质少年 提交于 2019-12-10 16:32:32
问题 The following code is the most Minimal, Complete, and Verifiable example that I could find. My true case is much more complicated: x = 1:0.1:10; y = sin(x); subplot 211 plot(x,y) [leg,att] = legend('show'); title(leg,'my title') leg.Title.Visible = 'on'; subplot 212 plot(x,y) leg = legend('show'); title(leg,'my title') This results in: As you can clearly see, something is wrong with the upper legend title. Somehow, asking for the att output of the legend interfere with its' title. First, for

Matlab; Pie chart with 2+ / split legends R2017b

别来无恙 提交于 2019-12-10 16:03:32
问题 I'm creating a pie chart and ideally want the legend to be displayed horizontally at the top and/or bottom. However, in almost all cases this isn't possible as the legend go off the figure. Therefore, I'd ideally like to split the legend into two (or more) sub-legends and place them individually. I'm aware that this isn't a built-in feature in MATLAB (I'm using R2017b) but I'm not sure if it's something that can be bodged to work? I've seen a few people manage to do similar things with line

Moving fill background to the bottom after saving as jpg

穿精又带淫゛_ 提交于 2019-12-10 14:14:38
问题 When I use fill or viscircles functions to plot circles with background to the plot, in figure it appears on the top of the plot, as it was intended, but after saving as jpg or png, the background moves to the bottom of the plot and is not visible anymore. How do I fix this? note: it's not because white is transparent color. I tried gray, I tried red, both are behaving the same as white. 回答1: Please consider the following example (made on MATLAB 2015a): figure(); h=cell(1); %% viscircles

Disallow MATLAB to take focus automatically [duplicate]

别等时光非礼了梦想. 提交于 2019-12-09 16:39:35
问题 This question already has answers here : Inhibit Matlab Window Focus Stealing (2 answers) Closed 6 months ago . I have the following problem: in my MATLAB code I use statements like figure(1) to change destination figure for some data. The problem is that after this MATLAB take system focus on the window with this figure. When I run a big script in the background and try to do something else on my computer, MATLAB always takes focus and I can't do something normally. Is there a way to

Saving graph produced in MATLAB maximized to fullscreen

耗尽温柔 提交于 2019-12-09 07:33:21
问题 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? 回答1: 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(