How to fix the figure plot always being above on the screen?
72 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
YINGGANG
el 4 de Jul. de 2022
Respondida: YINGGANG
el 7 de Jul. de 2022
Dear all friends,
When I generate a figure plot in matlab, how could we make the plot always being above on the screen?
It is unconvient when I debug my code row by row and the plot would be disappear, and I have to adjust the matlab window to make figure plot and matlab window being shown together.
is there any way to achieve the figure plot fixed above on the screen ?
0 comentarios
Respuesta aceptada
Más respuestas (3)
MJFcoNaN
el 4 de Jul. de 2022
Hello,
You may set the figure property of WindowStyle to 'modal' :
f=figure;
f.WindowStyle='modal';
PS: 'docked' is another option if you don't want the figure always cover a part of screen.
Abhijit Nayak
el 4 de Jul. de 2022
From your query, I can guess you want to position the plot graph at some point on the screen which would help you to debug your code.
Take the following example and I hope you can edit the pixel location according to your need.
f1= figure;
x=1:10;
y=sin(x);
plot(x,y);
figure(f1);
f1.Position(1:2)= [0 0]
For further information, check this out: https://www.mathworks.com/help/matlab/ref/figure.html
Shyam
el 4 de Jul. de 2022
Hello YINGGANG
It is my understanding that you want to fix the figure plot on the screen , so that both the code and plot appear together and it will be easy for you to debug the code.
You can achieve this by reproducing the steps as follows :
1.You need to dock the figure window to matlab window using the dock option(curved arrow) given in figure window.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054180/image.png)
2.A seperate figure window will appear beside the editor window in the matlab.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054185/image.png)
3.Click and hold on the docked figures window titlebar and pull the cursor and adjust according to your convinience .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1054190/image.png)
or alternatively you can use a live script where as you code and run , the results/plots appear to the right.So you can look at the code and the results at a time
5 comentarios
Walter Roberson
el 7 de Jul. de 2022
If the code window is always the same size, then once you have manually positioned a figure once you can do
Nice_Figure_Position = get(gcf, 'Position');
and after that, every time you generate a new figure, you can do
set(gcf, 'Position', Nice_Figure_Position)
Ver también
Categorías
Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!