开发者

MATLAB: why would an axis have its position property changed?

开发者 https://www.devze.com 2023-01-06 10:09 出处:网络
I\'m working on a custom plot on top of which I add a second blank axis object to show a secondary scale on the right hand side of the graph (as well as the primary scale on the开发者_开发知识库 left

I'm working on a custom plot on top of which I add a second blank axis object to show a secondary scale on the right hand side of the graph (as well as the primary scale on the开发者_开发知识库 left hand side).

Works great (and had been, for years), until I tried it again recently in R2010a and for some reason the primary axis gets its Position property tweaked when the figure is resized or printed, so that it looks OK on the screen at first, but when I print it or resize the figure, the two axes don't line up vertically.

What would do this, and how can I set it up so the two axes maintain the same position?


aha: I think I found it:

http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f1-32495.html

Controlling Axes Size

When you create a graph, MATLAB automatically creates an axes to display the graph. The axes is sized to fit in the figure and automatically resizes as you resize the figure. However, MATLAB applies the automatic resize behavior only when the axes Units property is set to normalized (the default).

Note: MATLAB changes only the current axes' properties by default. If your plot has multiple axes, MATLAB will not automatically resize any secondary axes.

You can control the resize behavior of the axes using the following axes properties:

...

ActivePositionProperty — Specifies whether to use the OuterPosition or the Position property as the size to preserve when resizing the figure containing the axes.


You may find the linkprop function helpful

0

精彩评论

暂无评论...
验证码 换一张
取 消