Limit of Decreasing Plot Size in MATLAB
1 view (last 30 days)
Show older comments
I use MATLAB R2021b. I have a 10x10 data array and I am using contourf function to plot the data. By default, MATLAB gives me a figure with 1120x840 pixels.
I know that I can use the command
set(gcf, 'position', [700, 700, 100, 100])
to decrease the size of the figure. And I get a figure with 200x200 pixels. I decided to shrink the value in the set function by half to get a 100x100 figure.
However, when I try to do
set(gcf, 'position', [700, 700, 50, 50])
, I got a figure with size 100x160. No matter how much further I decrease the value in the set function, the second dimension of the figure remained at 160 pixels. And there's no problem with the first dimension -- it can shrink with the value in the set function.
Does anyone know what's the problem here? My goal is to get a figure with 100x100 pixels.
Thank you very much for any advice!
2 Comments
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 21 Jan 2023
You should try these options with 'units', 'pixels':
set(gcf,'units', 'pixels','position', [700, 700, 50, 50])
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!