figure won't come up after using plot
이전 댓글 표시
I am fairly new to MATLAB. In the past I've been able to plot with no trouble. A figure would automatically come up after I used "plot". Now when I plot, no figure appears. Here's a simple example:
>> x = 1:10;
>> y = 3*x;
>> plot(x,y)
>>
Nothing comes up after this - no error message, no figure. I'm hoping this involves something simple like changing a setting. It worked fine just a week or two ago.
I tried using the "plottools" command, but that just brings up a blank figure window. It also gives me the following message in the command window:
>> plottools
Warning: OpenGL appears to be installed incorrectly.
> In opengl at 150
In getplottool>createOrGetSelectionManager at 71
In getplottool at 58
In plottools at 148
>>
I should also mention that I have been remote accessing my office computer for the last week and I can't recall if this problem started before or after. Though I wouldn't think that would be the cause of the problem. Any help would be greatly appreciated.
댓글 수: 5
Andrew Newell
2011년 5월 15일
This sounds like a problem for MATLAB Support.
Walter Roberson
2011년 5월 15일
Some forms of remote access can cause this problem. How are you accessing?
Craig
2011년 5월 16일
Joao Melo
2016년 7월 7일
Hello, could you solve this problem? I am having the same issue and I also started remotelly acessing my computer. How did you solve this? Thank you
Frederika Sefaj
2020년 4월 13일
just write figure(1), or howerver your figure was called
채택된 답변
추가 답변 (8개)
Joao Melo
2016년 7월 7일
35 개 추천
Ok, figured it out:
In one of the menus in the task bar there is one called plots (Home Plots Apps).
One the far rigth side, there are two options: Reuse figure or new figure.
1) Make sure it is in new figure 2) Restart Matlab 3) Your plot should open
댓글 수: 11
John Ondov
2018년 7월 13일
편집: John Ondov
2018년 7월 13일
Joao's solution worked for me! I shall be making use of the drawnow command also as posted by Raady. Thank you both!
Akila Wijeratne
2020년 3월 6일
Thank you, it worked!
Akshay Raju
2020년 8월 19일
Awesome! Worked for me
Maymarie van den Heever
2020년 9월 5일
Same here, thx!
Jordan Willis
2020년 12월 10일
Shout out to Joao. I almost punched a hole through my monitor trying to figure this out.
Arunima Sarkar
2021년 4월 18일
Thank you JOAO..
michelle
2023년 5월 8일
This worked for me, as well! Thank you!
Shivam
2024년 5월 13일
Worked for me as well just before i needed to submit my plot, you are a legend.
Thanks a lot
Mariami
2025년 9월 25일
Yay Worked!
I was getting ready to start crying :D
Mikolaj
2025년 10월 18일
Thank you so much
Vesa
2026년 1월 15일
This saved my day, thank you!
Raady
2016년 1월 6일
4 개 추천
this answer helps when body checking this thread again.
if you are using the figure to plot in a loop, you have to use command as below , then you can see the figure.
drawnow;
댓글 수: 1
HABILA
2018년 2월 23일
I also had the issue on running my old code ploting figures on loop using hold on, earlier it was working fine in MATLAB2008 and MATLAB2011 but it wasn't showing plot while running the same code in MATLAB2015. Now adding the command drawline its working fine. don't know the exact reason why... still thank you !
Arturo Moncada-Torres
2011년 5월 16일
Have you tried opening a figure "by hand"?
noFigure = 1;
figure(noFigure);
x = 1:10;
y = 3*x;
plot(x,y);
Hope it helps ;-)!
댓글 수: 4
Craig
2011년 5월 16일
Sean de Wolski
2011년 5월 16일
h is the handle to your figure.
What happens if you type:
figure(h)
?
Arturo Moncada-Torres
2011년 5월 16일
This is a handler. A handler is a numerical identifier that makes reference to an object. With it, you can access and manipulate the object's properties. However, I think this is not what we are looking for.
Craig
2011년 5월 16일
Sean de Wolski
2011년 5월 16일
Are you on Macintosh?
I have problems with MATLAB figures hiding behind things, a major shortcoming of MacOSX in general.
I wrote a script fgcf.m that is literally
figure(gcf)
So in the event that I plot something and it appears on a hidden figure that figure is surfaced.
댓글 수: 3
Craig
2011년 5월 16일
Sean de Wolski
2011년 5월 16일
Call Tech Support and/or reinstall...
Terry
2025년 9월 18일
This worked for me on MacOSX
No idea what this hidden figure thing is but dang it is annoying
Paulo Silva
2011년 5월 16일
0 개 추천
I had that problem in MATLAB 2008b for awhile, no clue what caused it and what fixed it, just put figure before the plot command.
Arturo Moncada-Torres
2011년 5월 16일
You could try:
x = 1:1 0;
y = 3*x;
gcf;
plot(x,y);
Give it a try ;-) !
댓글 수: 2
Mike Majer
2014년 8월 29일
이동: DGM
2025년 8월 5일
Thanks Arturo Moncada-Torres. I think the gcf line got it for me. What is gcf?
Rick Pooler
2017년 2월 23일
이동: DGM
2025년 8월 5일
gcf - get current figure
Shubham Agrawal
2019년 2월 24일
First of all there is no loop in your matlab script. You can use 'For' loop in this particular program.
Secondary thing is that you are not making any matrix which can store value of inputs and outputs.
I am pasting solution for your query. This thing is working.
k=0;
Y=[ ];
X=[ ];
for x=0:10
y=3*x;
k=k+1;
X(k,1)=x;
Y(k,1)=y;
end
plot(X,Y)
댓글 수: 1
Walter Roberson
2020년 4월 13일
The user had
y = 3*x;
y will be a matrix that stores the appropriate values corresponding to the vector of x values.
There is no need at all to use a loop for this purpose; vectorization is perfectly fine.
The problem had nothing at all to do with this. The user was using remote access software that was interfering with being able to get the proper plots.
Supriya
2025년 8월 4일
0 개 추천
I'm relatively new to MATLAB. Previously, I had no issues with plotting — a figure window would automatically open whenever I used the plot command. However, now when I try to plot something, no figure window shows up.Please resolve it.
댓글 수: 3
DGM
2025년 8월 5일
If I had to guess, I'd guess that you had a figure window under your main window and you're just not seeing it. If I didn't have to guess, I wouldn't be guessing.
Vinod
2025년 8월 7일
Are you using MATLAB on yoru desktop or MATLAB Online? If you see this behavior in MATLAB Online, try the MATLAB Answer here.
Stephen
2025년 9월 3일
Im having the same issue in Matlab on fedora, if im in -nodesktop or -nodisplay no plot will show up and that didnt used to be the case.
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!