SEMILOGY not printing proper y axis labels

4 次查看(过去 30 天)
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?

回答(1 个)

Wayne King
Wayne King 2013-10-28
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])

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by