matlab-figure

How to edit property of figure saved in .fig file without displaying it

谁都会走 提交于 2019-12-01 21:03:14
I want to edit a certain property of MATLAB figures saved as .fig (MATLAB's default format) files. I create a lot of graphics-intensive figures in a script, so I choose not to display them by making the default figure invisible with set(0,'DefaultFigureVisible','off') . This sets the 'Visible' property of any new figure to 'off' . This way I can create, edit, save, etc., figures without the need to draw them, which can be taxing on CPU, GPU and their memories. I save the figures as .fig files using the saveas(handle,'filename.fig') command. This also saves the 'Visible' property, which is a

MATLAB - striped area under the xy curve (bending moment distribution) [closed]

时光毁灭记忆、已成空白 提交于 2019-12-01 20:52:28
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago . what I want to achieve is a classical bending moment distribution plot that may look something like that: I tried to use area, xy, and bar plot and the last one is the closest to what I need - but it's still not what I can accept. I can use data in arbitrary form. 回答1: While Daniel's answer is more

Why do drawing commands like 'rectangle' and 'line' ignore 'hold off'?

眉间皱痕 提交于 2019-12-01 20:44:15
问题 I'm trying to display a changing rectangle in a loop, with pause, and it ignores hold off (which actually suppose to be default). Here's a simplified version's code : clc; close all; clear all; rect = [10 10 20 30]; figure axis([0 200 0 50]); for i = 1 : 15 rect(1) = rect(1) + i; rectangle('Position', rect, 'edgeColor', [1 0 0]); hold off; pause(0.2); end Is it on purpose? Am I missing something? What can I do to make the previous rectangles disappear, aside from ploting it in white after

Why do drawing commands like 'rectangle' and 'line' ignore 'hold off'?

余生长醉 提交于 2019-12-01 20:44:06
I'm trying to display a changing rectangle in a loop, with pause, and it ignores hold off (which actually suppose to be default). Here's a simplified version's code : clc; close all; clear all; rect = [10 10 20 30]; figure axis([0 200 0 50]); for i = 1 : 15 rect(1) = rect(1) + i; rectangle('Position', rect, 'edgeColor', [1 0 0]); hold off; pause(0.2); end Is it on purpose? Am I missing something? What can I do to make the previous rectangles disappear, aside from ploting it in white after each iteration? Thanks.. edit : The very simplified version was solved, but if I want to also plot another

Shading of area between two lines not working correctly in MATLAB

痞子三分冷 提交于 2019-12-01 20:26:32
I am trying to plot the shaded uncertainty (upper and lower bounds) along a line. I tried using the fill function but it is including an area larger than I want. I have an upper error (black), lower error (green), and actual data line (red), like so: How do I get the area between the green and black lines? I tried the following: fill([date fliplr(date)], [data_Upper fliplr(data_Lower)], 'r'); But the fill function covers both line areas all the way to the bottom of the plot: How do I fix this to only shade the area between the lower and upper error line bounds? It seems to me that you have

How to remove axis in MATLAB

烂漫一生 提交于 2019-12-01 17:45:54
axis off Not working. function displayResults(filename,hObject, eventdata, handles) % Open 'filename' file... for reading... fid = fopen(filename); for N=6:1:10 imagename = fgetl(fid); if ~ischar(imagename), break, end % Meaning: End of File... [x,map]=imread(imagename); rgb=ind2rgb(x,map); ax = handles.(sprintf('axes%d', N)); axis off; image(rgb, 'Parent', ax); end guidata(hObject,handles) Above code results in following output: I've highlighted axis in above figure. All images I've used is bitmap with bit depth of 8. I don't want those axis, how can I remove that? insert the following at the

MATLAB: misaligned boxes in plotyy after saving as fig

我的梦境 提交于 2019-12-01 17:29:16
I use plotyy to put two plots in one graph: f = figure('Color','white'); [ax,p1,p2] = plotyy(xx, yy1, xx, yy2); ylabel(ax(1),'Phase','FontSize',18); ylabel(ax(2),'Spectrum','FontSize',18); set(ax,{'ycolor'},{'k';'k'}); set(p1,'LineWidth',2,'Color',[0.4940,0.1840,0.5560]); set(p2,'LineWidth',2,'Color','red'); xlabel(ax(1),['Frequency [THz]'],'FontSize',18); set(ax,'FontSize',14) Figure is displayed perfectly, but when I try to save it as fig something like misaligned boxes appears. I tried to use linkaxes, but with no result. plotyy has been one of my favorite MATLAB functions to love to hate.

MATLAB: misaligned boxes in plotyy after saving as fig

余生颓废 提交于 2019-12-01 17:05:04
问题 I use plotyy to put two plots in one graph: f = figure('Color','white'); [ax,p1,p2] = plotyy(xx, yy1, xx, yy2); ylabel(ax(1),'Phase','FontSize',18); ylabel(ax(2),'Spectrum','FontSize',18); set(ax,{'ycolor'},{'k';'k'}); set(p1,'LineWidth',2,'Color',[0.4940,0.1840,0.5560]); set(p2,'LineWidth',2,'Color','red'); xlabel(ax(1),['Frequency [THz]'],'FontSize',18); set(ax,'FontSize',14) Figure is displayed perfectly, but when I try to save it as fig something like misaligned boxes appears. I tried to

Drawing the top axis (box) line

会有一股神秘感。 提交于 2019-12-01 17:04:55
I have a plot with two lines and two different x-axis (different data units), which I plot like the following. My problem is that I would like to draw the top line of the box black as well (horizontally), and not leave it "open" like it is. It would be great if the line had the x-axis ticks as well, same as the bottom horizontal axis line. Obviously, grid on doesn't work, because it draws the y1-axis ticks on the right and the y2-axis ticks on the left, which I don't want. Also, I think in Matlab 2014, this worked: set(ax(2),'XAxisLocation','top','XTickLabel',[]); but it doesn't anymore in

Drawing the top axis (box) line

帅比萌擦擦* 提交于 2019-12-01 16:35:48
问题 I have a plot with two lines and two different x-axis (different data units), which I plot like the following. My problem is that I would like to draw the top line of the box black as well (horizontally), and not leave it "open" like it is. It would be great if the line had the x-axis ticks as well, same as the bottom horizontal axis line. Obviously, grid on doesn't work, because it draws the y1-axis ticks on the right and the y2-axis ticks on the left, which I don't want. Also, I think in