Plot and scale very small numbers

Hi all,
I am interested in ploting the following y-axis (from 10^-16 to 10^-11) in Matlab:
Sample_plot.PNG
I use the following codes, but I did not get the nicely spaced y-axis as above. What changes should I amend to the codes to get the above y-axis for my y-data?
figure
plot(x,y,'o','r')
ylim([10^-17 10^-10])
yticks([10^-16 10^-15 10^-14 10^-13 10^-12 10^-11])
Thank you for your suggestions.

 採用された回答

Adam Danz
Adam Danz 2018 年 11 月 29 日
編集済み: Adam Danz 2020 年 12 月 4 日

0 投票

You need to make the yscale log.
figure;
h = axes;
h.YScale = 'log'; % <------- or set(h, 'YScale', 'log')
ylim([10^-17 10^-10])
yticks([10^-16 10^-15 10^-14 10^-13 10^-12 10^-11]) % (not needed)

4 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 29 日
learn4fun's answer moved here for consistency
Hi Adam,
Thank you for your suggestion :)
Swati Sarangi
Swati Sarangi 2020 年 12 月 4 日
Hi Adam ,
I am unable to implement your code in my machine. Is there any alternative to it?
Rik
Rik 2020 年 12 月 4 日
Why are you unable to implement this? What release are you using?
Steven Lord
Steven Lord 2020 年 12 月 4 日
Another way to get a linear X axis and a logarithmic Y axis is to use semilogy.
x = 1:6;
y = 10.^-(10+x);
semilogy(x, y)

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAxes Appearance についてさらに検索

製品

リリース

R2018a

質問済み:

2018 年 11 月 29 日

コメント済み:

2020 年 12 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by