problem with 2nd axis Yticks with plotyy and semilogy

10 ビュー (過去 30 日間)
Ronald Haynes
Ronald Haynes 2015 年 5 月 2 日
回答済み: dpb 2015 年 5 月 2 日

Hi folks, I was hoping the following code:

[ax,h1,h2]=plotyy([overlap,overlap],[error{2},error{3}], ...
                    overlap,initial,'semilogy','semilogy');
set(ax(1),'YLim',[10.^(-15) 10.^(-1)]);
set(ax(1), 'YTick', [10.^(-15) 10.^(-13) 10.^(-11) 10.^(-9) ...
                     10.^(-7)  10.^(-5)  10.^(-3)  10.^(-1)])
set(ax(2),'YLim',[10.^(-6)  10.^(-2)]);
set(ax(2),'YTick', [10.^(-6) 10.^(-5) 10.^(-4) 10.^(-3) 10.^(-2)]);

Would put the 10^(-6) ... 10^(-2) ticks on the right y axis of the plot. Instead I get the attached plot. Any suggestions?

  2 件のコメント
Ronald Haynes
Ronald Haynes 2015 年 5 月 2 日
My plot is not appearing! the tick marks I am seeing are 1e-06, 3.16228e-06, 1e-05,3.16228e-05 and 0.0001
Very strange!
dpb
dpb 2015 年 5 月 2 日
No figure attached...

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

採用された回答

dpb
dpb 2015 年 5 月 2 日
Don't have your data to play with specifically, but a dummy set
>> y1=logspace(-1,-15,10).*rand(1,10);
>> y2=logspace(-2,-6,10).*rand(1,10);
>> hAx=plotyy(1:10,y1,1:10,y2,@semilogy,@semilogy);
>> ylim(hAx(1),[1e-15 1e-1])
>> set(hAx(1),'ytick',[1e-15, 1e-10 1e-5 1e-1])
>> ylim(hAx(2),[1e-6 1e-2])
>> set(hAx(2),'ytick',[1e-6, 1e-4 1e-2])
>>
has the expected result here. Of course, since there aren't the same number of ticks on the LH and RH axes you'll have the resulting "extra" tick on the RH axis corresponding to the location of the intermediaries on the left--this is a fignewton of the Matlab graphics that can't really be avoided.

その他の回答 (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