Two Y axes not lining up (semilogx for one, line for the other)
Show older comments
Hi there,
I have two sets of axes set up. On the first (left Y and bottom X) I am plotting a "semilogx" function to plot. On the second set of axes (right Y and top X) I am simply using a "line" function to plot. The tick marks are set up the same on both (except that I manually changed the labels for the right Y axis) - they should be at 800, 600, 400, 200. The two Y axis tick marks line up fine when I am using a simple "line" function for the first set of axes. BUT when I use a "semilogx" function, for some reason the right Y axis gets these odd misalignments. Here is a sample:
Any help would be appreciated!
Thank you!
Aaron
1 Comment
Aaron Burdick
on 29 Sep 2011
Answers (1)
Walter Roberson
on 29 Sep 2011
For this kind of plotting, one would normally use plotyy(), specifying the plotting functions to use:
plotyy(x1,y1,x2,y2,@semilogy,@plot)
3 Comments
Aaron Burdick
on 29 Sep 2011
Walter Roberson
on 29 Sep 2011
Yes: you can set the XAxisLocation property for one of the axes to 'top', and you can set its XTick and XTickLabel at will.
Aaron Burdick
on 9 Oct 2011
Categories
Find more on Grid Lines, Tick Values, and Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!