Enlarging y-Axis because text description of two points is overlapping

1 Ansicht (letzte 30 Tage)
I am trying to plot the following. The problem is the text description of two points ('BBD1', 'BBD2') is overlapping and I am trying to solve this by making the space between the ticks on the y-Axis larger.
Is that possible, and if not is there a better solution to my problem?
x = [6.27, 2479.79, 49.46, 43.95, 900.98, 773.49];
y = [22.48, 5.89, 19.52, 19.89, 1.64, 2.25];
txt = {'BD','DD','BBD1','BBD2','BBD3','B4'};
plot(x,y,'*');
text(x,y,txt);
Kind regards

Akzeptierte Antwort

Abdolkarim Mohammadi
Abdolkarim Mohammadi am 2 Nov. 2020
A simple solution is to add horizontal and vertical offset so that you can better control the position of the labels.
x = [6.27, 2479.79, 49.46, 43.95, 900.98, 773.49];
y = [22.48, 5.89, 19.52, 19.89, 1.64, 2.25];
txt = {'BD', 'DD', 'BBD1', 'BBD2', 'BBD3', 'B4'};
HorizontalOffset = [35, -150, 35, 35, 35, 35];
VerticalOffset = [0, 0, -0.5, 0.5, 0, 0.5];
plot (x, y, '*');
text (x+HorizontalOffset, y+VerticalOffset, txt);

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by