How to get the size or position of the plot box within a figure window?
Mostrar comentarios más antiguos
After much effort, I am still struggling to find the command to get the size or position of the plot box (i.e. the white box) within a figure window. What I really need is the aspect ratio of this white box, but a size or position command would get me there. I've tried variations of 'Position', 'PlotBoxAspectRatio', 'pbaspect',and 'DataAspectRatio' without luck.
For example, if I run the following command,
plot(1:100,1:100,'linewidth',5)
I want to know about the physical size/shape of the white box ONLY, not the grey box:

.
Thanks!
Paul
1 comentario
Mr M.
el 3 de Jul. de 2018
and how to get the size of the grey area? Because as far as I know, figure size consist the whole are with title bar also. But I need only the grey 'drawable' area.
Respuesta aceptada
Más respuestas (1)
Hieu Nguyen
el 9 de Feb. de 2018
You can use the subplot function:
pos = [0.3 0.6 0.2 0.4]; % [left bottom width height]
subplot('Position',pos);
Then, you can plot the figure that you need:
plot(1:100,1:100,'linewidth',5)
1 comentario
Gert Kruger
el 7 de Nov. de 2018
Thanks, using subplot is easier...
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!