labeling points on graph

I have this script:
n = [10e21,10e18,10e27,10e36,10e32]; kt = [10000, 10, 1000, 10, 10^5]; loglog(kt,n,'go')
How can I label each point on my graph with a unique string value?
I want to add the text, "Reactor" at the first point, and add another word to the second pt etc.
How can I do this?

回答 (1 件)

Joseph Cheng
Joseph Cheng 2016 年 2 月 7 日

1 投票

you can use the function text() like here in my example
n = [10e21,10e18,10e27,10e36,10e32];
kt = [10000, 10, 1000, 10, 10^5];
loglog(kt,n,'go')
strings = {' reactor', ' point 1',' point 2',' point3',' point4'}
for ind = 1:length(n)
text(kt(ind),n(ind),strings{ind})
end
i inserted an extra space at the beginning of each label to space it away from the point. since its a loglog plot you'll probably have to use a % of the n and/or kt spacing to properly space it.

2 件のコメント

Benjamin Cowen
Benjamin Cowen 2016 年 2 月 7 日
How can I make the text bigger?
Joseph Cheng
Joseph Cheng 2016 年 2 月 7 日

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

カテゴリ

タグ

質問済み:

2016 年 2 月 7 日

コメント済み:

2016 年 2 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by