Removing scientific notation in log plot
39 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Carroll
el 8 de Jun. de 2022
Comentada: Voss
el 8 de Jun. de 2022
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
0 comentarios
Respuesta aceptada
Voss
el 8 de Jun. de 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);
2 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!