loglog plot, change yticks to non 10^ values. IS there a straight forward way like for xticks
Show older comments
Hi there
Is there an straight forward way to have the yticks on the loglog plot in terms of 100 instead of 10^2?
I have got it to work, from seeing answers to previous questions posed to the community, but I'm confused as to why the yticks are so much more intricate than the xtick.
Thanks as always
Gerard
z = [2 4 6 10 15 20 30];
q = 2:2000;
V_h = zeros(length(z), length(q));
for ii =1:length(z)
V_h(ii,:) = (q*3.6)/(4*z(ii));
end
loglog(q,V_h)
grid
xlim([2 2000])
ylim([0.1 1000])
% Option 1
% Works for xtick, not ytick
set(gca, 'XTick', [0.1 1 10 100 1000 2000])
set(gca, 'YTick', [0.1 1 10 100 1000])
% Option 2
% Works for both xtick and ytick
set(gca, 'XTick', [0.1 1 10 100 1000 2000])
yticks = get(gca,'YTick');
set(gca,'YTickLabel',yticks);
% Option 3
% Works for both xtick and ytick
xticks([0.1 1 10 100 1000 2000])
yticks = get(gca,'YTick');
set(gca,'YTickLabel',yticks);
% Option 4
% Works only for xtick, not ytick
% xticks([0.1 1 10 100 1000 2000])
% yticks([0.1 1 10 100 1000])
Accepted Answer
More Answers (0)
Categories
Find more on Axis 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!

