How can I set the exact position of subplots in a figure?
160 views (last 30 days)
Show older comments
Michael Steinbuechler
on 14 May 2018
Commented: Ameer Hamza
on 14 May 2018
Hello Matlab-Pros,
I want to create subplots in a specific position on a figure. How can I achieve this? Does somebody have an idea?
On the following picture, you can see a screenshot of the figure and the highlighted position where the subplot should be created.
Thanks in advance,
Mike
0 Comments
Accepted Answer
Ameer Hamza
on 14 May 2018
Edited: Ameer Hamza
on 14 May 2018
If you want to create an axis on the specified location on the figure, just use
ax = axes('Position', [left bottom width height])
this will create an axis starting from the specified lower left corner with specified width and height. It will also return the axes handle ax.
Note that the values are specified in normalized units, i.e. the position values can change from 0 to 1.
4 Comments
Ameer Hamza
on 14 May 2018
If you just want to use subplot instead of axes() then you can still do what you want. For example
% instead of axes() use this.
ax = subplot(121) % 121 is for example
ax.Position = [] % define your position
will work too.
More Answers (0)
See Also
Categories
Find more on Subplots 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!