views:

42

answers:

2

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?

+2  A: 

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.

Jason S
+2  A: 

You may find the linkprop function helpful

Amro
cool, thanks...
Jason S