How can I plot a diagonal line on a log-log scale plot?
16 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2020 年 5 月 12 日
回答済み: MathWorks Support Team
2020 年 5 月 27 日
I have a "loglog" plot of data and I want to plot a diagonal line from corner to corner. How can I do this?
採用された回答
MathWorks Support Team
2020 年 5 月 12 日
The most straight forward way to do this is to "loglog" plot a "logspace" array across the bounds that you are working with. For example:
x = logspace(0,15);
scatter(x,x)
grid on
hold on
loglog(x,x)
hold off
Alternatively, you can call "plot" with a "linspace" array as both the "x" and "y" arguments.
x = logspace(0,15);
scatter(x,x)
grid on
hold on
y = linspace(1,1e15);
plot(y,y)
hold off
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!