how to set y-axis as log scale?
7,236 ビュー (過去 30 日間)
古いコメントを表示
Rohit Bhoi
2016 年 4 月 15 日
編集済み: MathWorks Support Team
2023 年 9 月 22 日
I am plotting x-y plot using plot function. I want to set only y-axis as log scale and x-axis as linear? How to do that? I used loglog function but it scales both axis but I want only Y.
0 件のコメント
採用された回答
Walter Roberson
2023 年 9 月 22 日
編集済み: MathWorks Support Team
2023 年 9 月 22 日
The best way to create that type of axes is to use the semilogy function. Alternatively, you can set the ‘YScale’ property on the axes:
set(gca, 'YScale', 'log')
***Update from Mathworks Support Team - September 2023***
As of R2023b, you can also use the 'yscale ' function.
18 件のコメント
その他の回答 (2 件)
Rohit Sinha
2022 年 4 月 27 日
The easiest way to do this is simply use the following command instead of plot
semilogy(x,y);
This will plot x axis on a linear scale and y axis on a log scale. Similarly, if you want to plot x axis on log scale and y axis on a linear scale, you can use
semilogx(x,y) ;
2 件のコメント
Nicholas Santiago
2022 年 11 月 4 日
yo i totally missed that I generally only read the bold stuff, thanks a ton!
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!