Customizing scale of x-axis
19 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Adam Danz
on 2 Jun 2021
Edited: Adam Danz
on 2 Jun 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';
More Answers (0)
See Also
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!