Set the width of a subplot & leave all else unchanged

19 views (last 30 days)
I have code that generates the following figure with subplots:
I'd like to reduce the width of each subplot and leave more room to the subplotTitles at the left. Resizing the entire figure window doesn't work, as everything is resized proportionately. If I use the EditPlot tool, I can manually reduce the width of the subplot using the mouse:
and then manually move the subplotTitle to the left, bringing me to my desired figure layout:
However, I'd like to do this with code. I know from here that the [x,y,width,height] of the entire axes handle can be specified; however, I don't want to override the automatically-computed y position and height - I only want to reduce the width.
Can I somehow only scale the width param of each subplot, while leaving all others unchanged?

Accepted Answer

z8080 on 14 Apr 2022
Edited: z8080 on 14 Apr 2022
Managed to find this out on my own. Code of the following sort is required for the subplots:
sph(i) = subplot(N_seeds, 1, i_seed);
sph(i).Position = sph(i).Position + 0.07*[1 0 -1 0]; % reduce width and shift to the right, leave all else unchanged

More Answers (0)




Community Treasure Hunt

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

Start Hunting!