altering a 2d plot for a time series

조회 수: 4 (최근 30일)
Richard
Richard 2012년 3월 14일
This is a rather basic question but here we go. I'm plotting a time series of data, and was wondering if instead of having dates on the xaxis is it possible for the xaxis to be an arrow (does that make sense?). So basically shows that as the xaxis continues to the right, time also increases.

답변 (2개)

Wayne King
Wayne King 2012년 3월 14일
You can certainly add an arrow using text()
plot(randn(100,1));
set(gca,'xtick',[]);
text(46,-3.5,'\rightarrow','fontsize',20);
Obviously, you can adjust the position and size of arrow as you wish.
  댓글 수: 1
Richard
Richard 2012년 3월 14일
So, is that to say that there is no built in function to plot on this type of axis? This doesnt seem to works very well,
text(length(time),min(Data),'\rightarrow','fontsize',20);
ylim([min(Data) max(Data)])
It still doesn't generate an arrow exactly on the xaxis, it is slightly offset.

댓글을 달려면 로그인하십시오.


Wayne King
Wayne King 2012년 3월 14일
I think you should use the Xlim and Ylim values of the current axis to place your arror
x = randn(100,1);
plot(x);
ax = gca;
set(gca,'xtick',[]);
ylims = get(ax,'Ylim');
xlims = get(ax,'Xlim');
text(xlims(2),ylims(1),'\rightarrow','fontsize',20);

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by