MATLAB: Problem with 2nd axis Yticks with plotyy and semilogy

plotyy

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!

Best Answer

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.