create plot with two different y axis

3 ビュー (過去 30 日間)
Locks
Locks 2013 年 4 月 21 日
Hi,
I have a plot for two different time series which both must be shown in the same figure. the problem is now, that for one dataseries, the y axis should be from 1000 to 1500 and for the other from 20 to 50, how can I do that?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 4 月 21 日
you can use plotyy function
plotyy(x,y1,x,y2)
  1 件のコメント
Locks
Locks 2013 年 4 月 21 日
thanks! this is working with the code below:
dates=dataSet(:,1);
%SPX
y1=dataSet(:,2);
%VIX
y2=dataSet(:,3);
plotyy(dates,y1,dates,y2);
set(gca,'Box','off')
but there is now another problem, the lines aren't starting at the left axis but there is a space between the left y axis and the line plotted in the graph and the same goes for the right axis.
I tried to use those comands:
% axis([8.5 11.5 0 1500]);
% set(gca,'xtick',9:0.5:11.5)
but I am not sure how I can use them when I have two differnt axis

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by