MATLAB: Plot time series in selected axes

axisplottimeseries

How can I plot a time series in an axes, for which I know the handle, rather than in the currently active axes?
For standard plots, if myTargetAxes is the handle to the axes, I can do:
plot(myTargetAxes, 1:200, tan((1:200)./12));
But this does not work with a time series because I can do
plot (myTimeseries)
but if I attempt to do
plot(myTargetAxes, myTimeseries)
I get the error: "A numeric or double convertible argument is expected."
I have found the workaround of calling
axes(myTargetAxes)
before
plot(myTimeseries)
but this seems very ugly. Is there a better way to do it?

Best Answer

plot for timeseries is actually a different function than the general plot. It's a member function of the timeseries class.
I just went through the code of the plot function ( edit timeseries.plot), and the way to specify the axes is with:
plot(myTimeseries, 'Parent', myTargetAxes);
It's kind of alluded to in the documentation where it says that Name, Value is used to specify the Chart Line properties. One of the chart line properties is indeed the parent axis. It certainly could be a bit more explicit.