MATLAB Answers

Fred
0

How to plot a second axis with vectors of different length?

Fred
さんによって質問されました 2015 年 3 月 30 日
最新アクティビティ dpb
さんによって 回答されました 2015 年 3 月 30 日
dpb
さんの 回答が採用されました
I want to create a plot with 3 time series. First DO with values starting from 1998 to 2012 and for secondary axis two other time series (lets call them F and D) which only have values for 1991, 2001, 2006 and 2011. It should look like this (I can do it in excel but not in Matlab):
I tried
plotyy
function but it gave me error for not having same vector length. What can I do? Thanks

  0 件のコメント

サインイン to comment.

タグ

製品

1 件の回答

dpb
回答者: dpb
2015 年 3 月 30 日
 採用された回答

You don't show what you tried specifically, but there's no problem with plotyy; you've got one array of some number of points and a second array of two variables with length four...
hA=plotyy(t1,d1,t2,d2,@plot,@scatter)
datetick('x','keeplimits')
where t1,d1 are the data fro the D0 vector and d2 is a 4x2 array of the area/forest data at the times in t2. This uses the "classic" date number; if have newer release with the timeseries class there are alternate ways to get the time axis formatting...

  0 件のコメント

サインイン to comment.



Translated by