问题
In matlab, how to change plot pan programmatically?
the function syntax from the documentation:
pan on
pan xon
pan yon
pan off
pan
pan(figure_handle,...)
h = pan(figure_handle)
the code seems to be used for enabling and disabling the tool and decide the pan direction vertically or horizontally , How could I change plot with handle pHandle
using pan
function or whatever programmatically.
回答1:
To change the pan, I generally use the axis limit functions
xlim(aHandle, [xlow xhigh])
ylim(aHandle, [ylow yhigh])
axis(aHandle, [xliw xhigh ylow yhigh])
To specifically pan only, for example 5 units to the left, you could use:
xlim(aHandle, xlim(pHandle)+5);
This last function use the xlim
command to read the current x axis limits, adds 5, and then uses the same function to set the x limits to a value that is 5 higher.
If the axis handle aHandle
is ommitted, then the result of gca
is used.
来源:https://stackoverflow.com/questions/14663412/programmatically-invoke-pan-tool