Subplot - Plots are not displayed
58 views (last 30 days)
Show older comments
Hi
I use the following easy script do plot some functions in subplots:
x = [1 3 4 5];
y = [2.3 4.1 5.2 -1];
z = [1 1 1 1];
a = [12 13 44 1];
subplot(2,2,1); plot(x)
subplot(2,2,2); plot(y)
subplot(2,2,3); plot(z)
subplot(2,2,4); plot(a)
But when I run the programm, although no error message occurs, also no plots are displayed. Why so? Thanks
2 Comments
Answers (2)
the cyclist
on 27 Jan 2013
The only thing I can think of is that your current figure window is either off your screen somewhere, or has the 'Visible' property set to 'off', so that it is not displaying.
What do you get for the 'Visible' property if you type
get(gcf)
Also, do you see the plots if you add a figure command in front of your plotting commands?
figure
x = [1 3 4 5];
y = [2.3 4.1 5.2 -1];
z = [1 1 1 1];
a = [12 13 44 1];
subplot(2,2,1); plot(x)
subplot(2,2,2); plot(y)
subplot(2,2,3); plot(z)
subplot(2,2,4); plot(a)
Failing that, I would restart MATLAB, and/or restart your computer. Not sure what to try other than that.
2 Comments
the cyclist
on 27 Jan 2013
I am not familiar with that error, but it suggests that MATLAB is somehow stuck trying to open a figure window.
You could try
>> close force all hidden
to try to shut all figure windows (and hopefully the pending one), and then try to run your code again.
Does this happen with a brand-new instance of MATLAB, in which you have not run any other commands? If so, that is extraordinarily weird to me, and I have no further suggestions other than to contact MathWorks support.
ks905383
on 12 Aug 2015
So I had this problem as well, and after messing around for a long time, I found a fix - there seemed to have been an issue with the image renderer it was trying to use. Setting
set(gcf,'Renderer','zbuffer')
Fixed the problem for me (I haven't tried it for different renderers, and I still don't know why this might've happened, without an error message)
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!