How to plot log-scale with number ?
古いコメントを表示
How can I plot log scale with the numbers like below image ?

採用された回答
その他の回答 (1 件)
the cyclist
2020 年 6 月 8 日
1 投票
3 件のコメント
Jeevan Kumar Bodaballa
2020 年 6 月 8 日
the cyclist
2020 年 6 月 8 日
There are multiple ways to do this task. Here is one way:
% data:
X = 2*logspace(1, 3, 100);
Y = rand(100,1);
% Locations of the ticks (and also how we want them labeled)
tickLoc = [20 30 50 70 100 200 300 500 1000 2000];
% Create a new figure window, and plot the data with log x-axis
figure
semilogx(X,Y);
% Set the axis limit, tick locations and labels
set(gca, ...
'XLim',[20 2000], ...
'XTick', tickLoc, ...
'XTickLabel',tickLoc);
Tommy's solution and mine are doing effectively the same thing (although I did not do all the little things he did like make the tick marks point outward). The biggest difference is that I used the semilogx command, where he created the axes first, and then set the 'XScale' property to 'log'.
Jeevan Kumar Bodaballa
2020 年 6 月 8 日
カテゴリ
ヘルプ センター および File Exchange で Log Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!