problem with 2nd axis Yticks with plotyy and semilogy

9 visualizaciones (últimos 30 días)
Ronald Haynes
Ronald Haynes el 2 de Mayo de 2015
Respondida: dpb el 2 de Mayo de 2015

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 comentarios
Ronald Haynes
Ronald Haynes el 2 de Mayo de 2015
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 el 2 de Mayo de 2015
No figure attached...

Iniciar sesión para comentar.

Respuesta aceptada

dpb
dpb el 2 de Mayo de 2015
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.

Más respuestas (0)

Categorías

Más información sobre Two y-axis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by