Add text to loglog-plot?

Hi,
I'm trying to add text to a loglog-plot (a number above a plotted line, denoting a quantity), but I can't get the text-command to work. Is it at all possible or does it only work for non-loglog plots?
Best Regards Martin

1 件のコメント

Stefan Damjancevic
Stefan Damjancevic 2021 年 8 月 11 日
Have you solved this issue. It is really bothersome.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 3 月 1 日

0 投票

It works for me.
x = 1 : 100;
y = rand(1,100);
loglog(x, y);
text(20,.5, 'hello')
The text does appear and does get placed at data coordinates (20,.5)

4 件のコメント

Martin
Martin 2018 年 3 月 1 日
That means that something else must be the problem. Thank you =)
Walter Roberson
Walter Roberson 2018 年 3 月 1 日
Remember, no negative coordinates for a loglog plot.
Stefan Damjancevic
Stefan Damjancevic 2021 年 8 月 11 日
printing text is not the problem, position of the text is the problem. Due to log-log scale alliging the text several inches to the right of the data points is not as straight forward as text(xData+10, yData, 'text'). Namely the if the xData is close to >1 then the shift to right is large, but if the data is close to <10 then the shift to right is small i.e. the shift to the right in the figure is not consistent to human eyes.
Walter Roberson
Walter Roberson 2021 年 8 月 11 日
Good point. However the original person was getting no text at all.

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2018 年 3 月 1 日

コメント済み:

2021 年 8 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by