Customizing scale of x-axis

18 ビュー (過去 30 日間)
Bruno Rodrigues
Bruno Rodrigues 2021 年 6 月 2 日
編集済み: Adam Danz 2021 年 6 月 2 日
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.

採用された回答

Adam Danz
Adam Danz 2021 年 6 月 2 日
編集済み: Adam Danz 2021 年 6 月 2 日
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 件のコメント
Bruno Rodrigues
Bruno Rodrigues 2021 年 6 月 2 日
This worked like a charm! Thank you! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by