Limit of Decreasing Plot Size in MATLAB

1 view (last 30 days)
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!

Accepted Answer

Hsin Cheng
Hsin Cheng on 24 Jan 2023
Edited: Hsin Cheng on 24 Jan 2023
Hello everyone, I am the original poster. I think there is a minimum window size in both Windows and Mac operating systems. 100 pixels are smaller than the minimum windows size, so I cannot generate such a small figure.
This should be the answer for my question.
@Walter Roberson thank you very much for your hint. Your comment led me to this answer.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 21 Jan 2023
You should try these options with 'units', 'pixels':
set(gcf,'units', 'pixels','position', [700, 700, 50, 50])

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!