Removing scientific notation in log plot

37 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Voss
Voss il 8 Giu 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);

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by