필터 지우기
필터 지우기

Subplot - Plots are not displayed

조회 수: 22 (최근 30일)
MiauMiau
MiauMiau 2013년 1월 27일
답변: ks905383 2015년 8월 12일
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
Matt J
Matt J 2013년 1월 27일
Works fine for me.
MK_Earth
MK_Earth 2015년 7월 29일
I had the same problem. I just closed and reopen Matlab to trubleshooting

댓글을 달려면 로그인하십시오.

답변 (2개)

the cyclist
the cyclist 2013년 1월 27일
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
MiauMiau
MiauMiau 2013년 1월 27일
편집: MiauMiau 2013년 1월 27일
So, I tried it again and still I see no plots.
Again to repeat what I have done so far: the code
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)
has been saved in a .m file and I would just press the "run" button.
When I add "figure" I get an error:
Error using figure Error using figure Error using figure UIJ_AreThereWindowShowsPending - timeout waiting for window to show up
Error in Ex_1 (line 1) figure
And get(gcf) doesn't work either...:-/
the cyclist
the cyclist 2013년 1월 27일
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
ks905383 2015년 8월 12일
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)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by