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!