How to draw a two y axis and one x axis graph . The Two y axis should arrange in top and bottom and x axis should position in left side of the plot
1 回表示 (過去 30 日間)
古いコメントを表示
How to draw a two y axis and one x axis graph . The Two y axis should arrange in top and bottom and x axis should position in left side of the plot
2 件のコメント
Geoff Hayes
2014 年 10 月 7 日
Vishnu - you can use plotyy to plot two y-axes on the left and right side of the axes object. Please provide more details concerning what you are attempting, and why you would want the y axes on the top and bottom of the axes object.
回答 (1 件)
Evan
2014 年 10 月 15 日
編集済み: Evan
2014 年 10 月 15 日
If plotyy doesn't work for your purposes, you can create two axes with the same position, then set the 'Color' property of the top axes to 'none' so as to cause it to be transparent. You can then plot one set of data on one axes and one on the other, and change the x and y axis positions to suit your needs. This is quite a bit more messy than plotyy, but I've found it to be a workable solution for cases where I need more control than plotyy can offer.
Here's an example:
figure; a1 = axes; a2 = axes;
plot(1:5,1:5,'-r','Parent',a1)
plot(-2:0.1:2,5*sin(-2:0.1:2),'-g','Parent',a2)
set(a1,'XAxisLocation','top')
set(a2,'Color','none','YTick',[])
uistack(a2,'top')
1 件のコメント
Sean de Wolski
2014 年 10 月 15 日
I usually use plotyy to build it and then change whatever properties I need to afterward.
参考
カテゴリ
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!