How can I plot two vectors using the plotyy command, and after that plot two points with different y-scales on the same graph?

  • Graphing:
I have three vectors, Ia (current), Va (voltage), Pa (power).
First I want to plot "Ia vs Va" and "Pa vs Va" on the same graph, given that Ia and Pa have two different y-scales. (Ia: ylim([ 0 10], Pa: ylim([0 300]))
This can be done using the plotyy command without any problems.
But then I would like to plot the ordered pairs (Va(mpp), Ia(mpp),'bo') and (Va(mpp), Pa(mpp), 'go') on the same graph. So how can I specify that I want to plot the first pair one according to the left y-axis scale and the second one to the right y-axis?
Thank you very much!
Eid

回答 (2 件)

You can continue to add axes with no color and whose 'layer' is 'bottom' in the same position as the two axes created by plotyy().
Whenever I've had to do this, I start by creating a simple plotyy plot and then breaking the axes down using get:
[ax,h1,h2] = plotyy(1:10,1:10,1:10,100:-10:1);
Then compare:
get(ax(1))
with
get(ax(2))
To figure out what settings are doing what.
José-Luis
José-Luis 2012 年 12 月 14 日
編集済み: José-Luis 2012 年 12 月 14 日
[AX,H1,H2] = plotyy(Va,la,Va,Pa); %handles to the axes will be in AX
plot(AX(1),Va(mpp), Ia(mpp),'bo');
plot(AX(2),Va(mpp), Pa(mpp), 'go')

カテゴリ

ヘルプ センター および File ExchangeTwo y-axis についてさらに検索

質問済み:

Eid
2012 年 12 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by