incomplete minor gridlines in semilogx plot
Ältere Kommentare anzeigen
I would like to plot a semi-log plot with gridlines. The problem is that the plot needs to have a slightly elongated aspect ratio, and when I switch the aspect ratio the gridlines disappear. For example:
x = 10.^(-9).*[2,3,4];
y = [3,4,5];
figure(1); close(gcf); figure(1);
pos = get(gcf,'Position'); set(gcf,'Position',[pos(1),pos(2),0.5.*pos(3),pos(4)]);
semilogx(x,y,'-ok'); grid on; xlim([3*10^(-11),4*10^(-8)]);
no longer has minor xaxis gridlines even though XMinorGrid = on and XMinorTick = on. I can add most of the gridlines by altering the code to be:
x = 10.^(-9).*[2,3,4]; y = [3,4,5];
figure(1); close(gcf); figure(1);
pos = get(gcf,'Position'); set(gcf,'Position',[pos(1),pos(2),0.5.*pos(3),pos(4)]);
semilogx(x,y,'-ok'); grid on; xlim([3*10^(-11),4*10^(-8)]);
set(gca,'XTickMode','manual'); set(gca,'XTick',10.^[-11:1:-7]); %change
but I'm still missing the minor gridlines to the far right. Any ideas?
Thanks!!
Akzeptierte Antwort
Weitere Antworten (1)
It's a fignewton of the handle graphics and incomplete log cycles(*). AFAIK other than drawing the lines manually, all you can do is
xlim([3e-11),1e-7])
and they'll reappear. I've noticed this in the past--it'll complete them as long as the upper limit is the next power of 10 so you can chop off on the left but not on the right.
Mayhaps that's worthy of a bug report/enhancement request--I've not done so; don't know if it has been submitted previously or not.
ADDENDUM
(*) In conjunction with narrow-width plotting. At a certain point they do show up again despite the incomplete log cycle. It seems this may well be a bug rather than an intended feature; probably worth report to official TMW support at www.mathworks.com
1 Kommentar
Namaka
am 24 Jul. 2014
Kategorien
Mehr zu Time Series Events finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!