SEMILOGY not printing proper y axis labels

11 views (last 30 days)
Sam Butler
Sam Butler on 28 Oct 2013
Answered: Wayne King on 28 Oct 2013
I am creating 4 total plots, 2 per figure, using the same data; the first plot is a regular plot (using subplot and plot commands in MatLab R2013b); the second plot is a semilogy plot of the same data (using subplot and semilogy commands).
When I look at the results of the regular figure, I have a plot in real space that ranges from about 0 to 24 on the y axis, for both the top and bottom plots.
When I look at the results of the semilogy figure, I have a plot in real space that appears to be the right shape, but the y axis labels are wrong on both plots; there is only one label, midway up the y axis, with a value of 1 (ie, 10^0) on both plots. There are two problems with this: first, with only one label, it is difficult to determine the actual spacing; second, the plot should have a marking for at least 10^1 (ie, 10) as well, since I know the function has a value of at least 10.
I am using set(gca, 'YScale', 'log') already, as was indicated by another person's question, but that is not working; my results are the same regardless of whether I use that command.
How do I get the axis labels to display properly?

Answers (1)

Wayne King
Wayne King on 28 Oct 2013
Without the data, it's difficult to say exactly what is going on, but can you just set the yticks?
y = 0.1:0.5:24;
semilogy(y)
set(gca,'ytick',[10^-1 10^0 10^1])

Products

Community Treasure Hunt

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

Start Hunting!