Add space between scatterpoint and text label?
11 次查看(过去 30 天)
显示 更早的评论
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
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
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.
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!