How can I set the exact position of subplots in a figure?

191 次查看(过去 30 天)
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

采纳的回答

Ameer Hamza
Ameer Hamza 2018-5-14
编辑:Ameer Hamza 2018-5-14
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 个评论
Michael Steinbuechler
At first, I would have liked to create the subplots and move them to the highlighted area( in the picture of the question). For now, I will create each plot individually with their own axes.
That's how its supposed to look:
The reason why I would have used subplot at first is that the program I'm writing here can have different plot arrangements. By defining each ax individually (not like the 'grid' that subplot creates), it will take some programming to arrange the plots.
Ameer Hamza
Ameer Hamza 2018-5-14
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.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by