Removing scientific notation in log plot

32 次查看(过去 30 天)
Hello
I am trying to plot some data with the x axis in log scale. However as a result I seem to be getting x axis labeling in scientific notation and I would prefer simple integers. I am using the following code to create the graph.
figure('Name','2D Tunability')
plot(FreqS,Tunability2D,'k','LineWidth',2)
axis([0.1 20 min(Tunability2D)/1.01 max(Tunability2D)*1.01])
set(gca,'fontsize', 20)
set(gca, 'XScale', 'log')
The x variable is 0.1 to 20 in 0.1 steps and I have the y axis set to scale based on the data. But the x axis shows up in powers of 10. I would rather see it shown as 0.1, 1 10, 20 if possible. I have tried using the xtickformat command but it doesn't seem to have any effect on the plot. I'd also like to manually pick with tick point appear on the laabel if possible.
Thanks in advance

采纳的回答

Voss
Voss 2022-6-8
FreqS = 0.1:0.1:20;
Tunability2D = rand(1,numel(FreqS));
figure('Name','2D Tunability')
plot(FreqS,Tunability2D,'k','LineWidth',2)
axis([0.1 20 min(Tunability2D)/1.01 max(Tunability2D)*1.01])
set(gca, 'fontsize', 20, 'XScale', 'log')
% set the x-tick values:
xtick = [0.1 1 10 20];
xticks(xtick);
% set the x-tick labels, if you want:
% (but setting just the x-tick values seems to work ok in this case)
% xticklabels(xtick);

更多回答(0 个)

类别

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

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by