Customizing scale of x-axis

18 visualizaciones (últimos 30 días)
Bruno Rodrigues
Bruno Rodrigues el 2 de Jun. de 2021
Editada: Adam Danz el 2 de Jun. de 2021
Hello there,
I want to make a graph comparing my brother's hearing loss progress between the years. So far, so good.
However, audiograms generally have custom x-axis spacing between their values (they double for each interval). The spacing between 250 and 500 is the same as 500 to 1000, which is the same as 1000 to 2000, and so on, like the image shown below. How can I make this?
Thanks in advance.

Respuesta aceptada

Adam Danz
Adam Danz el 2 de Jun. de 2021
Editada: Adam Danz el 2 de Jun. de 2021
Set the XScale to log and then specify the x-ticks.
Demo:
x = [250 500 1000 1500 3000 4000 6000 8000];
y = rand(size(x));
ax = gca();
plot(ax, x,y,'--ok')
xticks = [250 500 1000 2000 4000 8000];
set(ax, 'XScale','log','XLim',[250,10000],...
'XTick',xticks,'XMinorTick','off')
grid(ax,'on')
ax.MinorGridLineStyle = 'none';
  1 comentario
Bruno Rodrigues
Bruno Rodrigues el 2 de Jun. de 2021
This worked like a charm! Thank you! :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Title en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by