How to change Semilogy axis

5 ビュー (過去 30 日間)
Tom Vogel
Tom Vogel 2019 年 4 月 1 日
回答済み: Star Strider 2019 年 4 月 1 日
I did a semilogy plot (see attachment) and wanted to ask how can I change the y-axis to give me e.g 10^0.1; 10^0.2 instead of 3.6 ; 3.4 etc ?

回答 (1 件)

Star Strider
Star Strider 2019 年 4 月 1 日
I’m guessing here.
Try this:
x = 2 + sort(rand(1, 8))*2;
y = 2.2 + sort(rand(1, 8), 'descend')*1.5;
figure
semilogy(x, y, 'x')
Ax = gca;
yt = Ax.YTick;
Ax.YTickLabel = sprintfc('10^{%.2f}', log10(yt));
You can also use the compose function:
Ax.YTickLabel = compose('10^{%.2f}', log10(yt));
Experiment to get the result you want.

カテゴリ

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

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by