Plot time series in selected axes
조회 수: 3 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
Guillaume
2015년 3월 12일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!