Problem with plotyy for standard deviation on my plot
1 次查看(过去 30 天)
显示 更早的评论
Hi, I want to plot the +1.5 and -1.5 standard deviation of my time series, in the same figure but with two y axes; but my code does not work.
plotyy(date,x,,[1.5*std,-1.5*stdd])
why?
0 个评论
回答(2 个)
dpb
2015-11-7
Well you didn't tell what you got for an error but for starters
is missing the x value for the second plot with an empty argument position. That won't work for sure. Secondly you have std as one of the values; it is the name of the function. I presume from the second you intended it to also be stdd
plotyy(date,x,date,[1.5*stdd,-1.5*stdd])
The orientation of the concatenation implies they are column vectors?
2 个评论
Walter Roberson
2015-11-8
drange = [min(date), max(date)];
plotyy(date, x, drange, repmat([1.5*stdd,-1.5*stdd], 2, 1))
I do not see any good reason to use two y axes; I would use the same y axis but with different colors
drange = [min(date), max(date)];
plot(date, x, 'k', drange, repmat([1.5*stdd, -1.5*stdd], 2, 1), 'r')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!