MATLAB: Save Axis Labels/Titles/Ticks for Iterative Plotting

handle graphicsplotting

I have two different surfaces to plot, under mildly different model assumptions. I go through a lot of trouble modifying the axis ticks, labels, title etc for the first surface. The majority of these are the same for the second surface, only the title will be different. Unfortunately when I replot the second set of data, all my work has disappeared! I need to go through all the axis labels, ticks etc. a second time. Is there a way to save all that info for iterative plotting?
Thanks.

Best Answer

If you have set the XTick or YTick property yourself, such as via set(), then the ticks will be retained when the data changes. More specifically, if you set() the XTick or YTick properties then the respective *TickMode property is set to 'manual', and when that property is 'manual' then ticks will not be recalculated.
The ticks and titles are part of the axes, so you can copyobj() the axes, set() it's Position if you need to, and set() the child surface's XData, YData, ZData (and perhaps CData) to the new data. If you took a bunch of trouble setting up the ticks on the first one, then the 'manual' property of the tick mode should be copied.
And if not... you can always set() the XTick or YTick properties of the new axes to the get() of the appropriate *Tick properties of the first axes.