figure won't come up after using plot

885 vues (au cours des 30 derniers jours)
Craig
Craig le 15 Mai 2011
Commenté : Mikolaj le 18 Oct 2025
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 commentaires
Joao Melo
Joao Melo le 7 Juil 2016
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
Frederika Sefaj le 13 Avr 2020
just write figure(1), or howerver your figure was called

Connectez-vous pour commenter.

Réponse acceptée

Craig
Craig le 21 Mai 2011
OK, I think I figured this out. When I start up MATLAB, I get this message and I'm guessing this has to due with the fact that I am remote accessing my office computer:
MATLAB only supports a screen depth of 16 or higher (Truecolor.)
MATLAB is running in headless mode. Figure windows will not be displayed.
  2 commentaires
Carmel Auerbach
Carmel Auerbach le 31 Juil 2021
So how is this solved? Im also accessing my computer remotely and cant see the content of the figures
Moch Yasin
Moch Yasin le 18 Nov 2023
This work for me too. thank you very much.

Connectez-vous pour commenter.

Plus de réponses (8)

Joao Melo
Joao Melo le 7 Juil 2016
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
  10 commentaires
Mariami
Mariami le 25 Sep 2025
Yay Worked!
I was getting ready to start crying :D
Mikolaj
Mikolaj le 18 Oct 2025
Thank you so much

Connectez-vous pour commenter.


Raady
Raady le 6 Jan 2016
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 commentaire
HABILA
HABILA le 23 Fév 2018
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 !

Connectez-vous pour commenter.


Arturo Moncada-Torres
Arturo Moncada-Torres le 16 Mai 2011
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 commentaires
Arturo Moncada-Torres
Arturo Moncada-Torres le 16 Mai 2011
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
Craig le 16 Mai 2011
I did try figure(h) and that just gave me an error. It says it must be an integer and h = 174.0028.

Connectez-vous pour commenter.


Sean de Wolski
Sean de Wolski le 16 Mai 2011
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 commentaires
Sean de Wolski
Sean de Wolski le 16 Mai 2011
Call Tech Support and/or reinstall...
Terry
Terry le 18 Sep 2025
This worked for me on MacOSX
No idea what this hidden figure thing is but dang it is annoying

Connectez-vous pour commenter.


Paulo Silva
Paulo Silva le 16 Mai 2011
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
Arturo Moncada-Torres le 16 Mai 2011
You could try:
x = 1:1 0;
y = 3*x;
gcf;
plot(x,y);
Give it a try ;-) !
  2 commentaires
Mike Majer
Mike Majer le 29 Août 2014
Déplacé(e) : DGM le 5 Août 2025
Thanks Arturo Moncada-Torres. I think the gcf line got it for me. What is gcf?
Rick Pooler
Rick Pooler le 23 Fév 2017
Déplacé(e) : DGM le 5 Août 2025
gcf - get current figure

Connectez-vous pour commenter.


Shubham Agrawal
Shubham Agrawal le 24 Fév 2019
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 commentaire
Walter Roberson
Walter Roberson le 13 Avr 2020
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.

Connectez-vous pour commenter.


Supriya
Supriya le 4 Août 2025
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 commentaires
Vinod
Vinod le 7 Août 2025
Are you using MATLAB on yoru desktop or MATLAB Online? If you see this behavior in MATLAB Online, try the MATLAB Answer here.
Stephen
Stephen le 3 Sep 2025
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by