フィルターのクリア

Add space between scatterpoint and text label?

15 ビュー (過去 30 日間)
Cliff Karlsson
Cliff Karlsson 2018 年 9 月 16 日
コメント済み: Cliff Karlsson 2018 年 9 月 16 日
I have a scatterplot where I have added text to every datapoint. It works as expected but the text is to low in respect to the datapints. I would like to add some space between the point and the actual label. How do I do that?
text(KPI,Inkomst, years, 'VerticalAlignment','bottom', 'HorizontalAlignment', 'center')
  1 件のコメント
Stephen23
Stephen23 2018 年 9 月 16 日
" I would like to add some space between ..."
What does that mean more concretely: do you want to translate horizontally up/down, or translate vertically up/down, or both?
Please describe how you want to move the text.

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

採用された回答

Stephan
Stephan 2018 年 9 月 16 日
編集済み: Stephan 2018 年 9 月 16 日
Hi,
depending on how you want to move the text with respect to your data you can use the
  • 'HorizontalAlignment' - Property
  • 'VerticalAlignment' - Property
  • or add a fixed value to the coordinates of your data points.
The description for #1 and #2 can be found in the documentation .
The last option is described here.
Also Adam Danz shared a function for this at File Exchange.
An example of the use of the give 3 options is:
x = randi(25,1,10)
y = randi(25,1,10)
scatter(x,y)
text(x, y+0.3, num2str(y(:)), 'HorizontalAlignment', 'center', 'VerticalAlignment', 'bottom', 'Color', 'r')
Best regards
Stephan
  1 件のコメント
Cliff Karlsson
Cliff Karlsson 2018 年 9 月 16 日
thank you "y+0.3" was what I was looking for.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by