How can I plot a reference line of slope 1 on a loglog plot?

5 ビュー (過去 30 日間)
Srh Fwl
Srh Fwl 2021 年 5 月 26 日
編集済み: Srh Fwl 2021 年 5 月 26 日
I am not an experienced Matlab user and would appreciate advice on adding diagonal reference lines to loglog plots. I.e., the lines need to have a slope of 1 when plotted.
According to this post (https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.axline.html), one way to do it is:
>>> axline((0, 0), (1, 1), linewidth=4, color='r')
However, this doesn't work for me. I get the error below (even though I followed the examples provided precisely and don't have mismatched delimiters). Can anyone please suggest an alternative method?
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

採用された回答

Srh Fwl
Srh Fwl 2021 年 5 月 26 日
Figured it out.
xref = 10.^(-1:.1:3);
yref = xref
plot(xref,yref)

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by