如何在图中的标签值及其表示值之间添加 space?
How to add space between labels values and its represented values in a plot?
以下代码绘制黑点。我想在黑点和每个点的红色标签编号之间创建一些分隔。
BBU = [41.3822706100000 2.12861183500000;
41.3951737600000 2.14739148800000;
41.4053832900000 2.15673183600000;
41.4083225700000 2.16864721900000;
41.4032320900000 2.20663354500000;
41.3939710600000 2.19351888300000;
41.3821269800000 2.18958664200000;
41.4188280200000 2.19925787100000;
41.3591028400000 2.13697455100000;
41.3813193100000 2.17610240700000;
41.3891879400000 2.17709430900000;
41.3932500600000 2.15626943700000;
41.3838562100000 2.16188867500000;
41.3720818100000 2.16253718100000;
41.3768090000000 2.14498916300000;
41.4001588800000 2.17864126300000;
41.4204607900000 2.18283805400000;
41.4010364200000 2.16198599800000];
nr_BBU = 18;
for i=1:nr_BBU
plot(BBU(i,2), BBU(i,1), 'k.', 'MarkerSize',25)
labels = cellstr(num2str((i)'));
text(BBU(i,2), BBU(i,1), labels, 'HorizontalAlignment','center',...
'VerticalAlignment', 'bottom', 'Color', 'r', 'FontSize', 12)
hold on
end
实际剧情:
向其中一个坐标添加一些偏移量似乎可以完成这项工作。
text(BBU(i,2)+0.001, BBU(i,1),labels,'HorizontalAlignment', ...
'center','VerticalAlignment', 'bottom',...
'Color', 'r', 'FontSize',12)
以下代码绘制黑点。我想在黑点和每个点的红色标签编号之间创建一些分隔。
BBU = [41.3822706100000 2.12861183500000;
41.3951737600000 2.14739148800000;
41.4053832900000 2.15673183600000;
41.4083225700000 2.16864721900000;
41.4032320900000 2.20663354500000;
41.3939710600000 2.19351888300000;
41.3821269800000 2.18958664200000;
41.4188280200000 2.19925787100000;
41.3591028400000 2.13697455100000;
41.3813193100000 2.17610240700000;
41.3891879400000 2.17709430900000;
41.3932500600000 2.15626943700000;
41.3838562100000 2.16188867500000;
41.3720818100000 2.16253718100000;
41.3768090000000 2.14498916300000;
41.4001588800000 2.17864126300000;
41.4204607900000 2.18283805400000;
41.4010364200000 2.16198599800000];
nr_BBU = 18;
for i=1:nr_BBU
plot(BBU(i,2), BBU(i,1), 'k.', 'MarkerSize',25)
labels = cellstr(num2str((i)'));
text(BBU(i,2), BBU(i,1), labels, 'HorizontalAlignment','center',...
'VerticalAlignment', 'bottom', 'Color', 'r', 'FontSize', 12)
hold on
end
实际剧情:
向其中一个坐标添加一些偏移量似乎可以完成这项工作。
text(BBU(i,2)+0.001, BBU(i,1),labels,'HorizontalAlignment', ...
'center','VerticalAlignment', 'bottom',...
'Color', 'r', 'FontSize',12)