Clear Filters
Clear Filters

Removing scientific notation in log plot

32 views (last 30 days)
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

Accepted Answer

Voss
Voss on 8 Jun 2022
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);

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!