I have a surface graph and on it I have plotted some points. Now I want to label each of these points. I used the following code.
name={'point1','point2','point3','point4','point5'}
co=[0 0 0];
scatter3(X,Y,Z,[],co,'filled');
c=cellstr(name);
dx = 0.1; dy = 0.1;
dz=0.1;
text(X+dx, Y+dy,Z+dz, c);
But the label data are not clear.
What can I do to make these labels clear?
Still after changing as 'Color', 'black', 'FontSize', 14)
the labels are displayed as

Still they are not clear.
ok now I got it:
use set(gca,'SortMethod','childorder')
I added an example below
name={'<-point1','<-point2','<-point3','<-point4','<-point5'};
co=[0 0 0];
X = repmat([1:10],1,10);
Y = sort(repmat([1:10],1,10));
Z = X.*Y;
X2 = repmat([1:10],10,1);
Y2 = X2';
Z2 = X2.*Y2;
figure
hold on
surf(X2,Y2,Z2);
set(gca,'View',[-45 30])
scatter3(X,Y,Z,[],co,'filled');
c=cellstr(name);
dx = 0.3; dy = -0.2;
dz=0.1;
%text(X(51:55)+dx, Y(51:55)+dy,Z(51:55)+dz, c,'BackgroundColor',[1 1 1]);
text(X(51:55)+dx, Y(51:55)+dy,Z(51:55)+dz, c,'Color','white','Fontweight','bold');
scatter3(X(51:55),Y(51:55),Z(51:55),[],ones(5,3),'filled','MarkerEdgeColor','k');
set(gca,'SortMethod','childorder')


Use the background property of the text command:
text(0,1,'Hi the first point','background',[1 230/255 230/255]);

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With