How to have number as marker symbol in plot
Show older comments
I'm trying to have a plot with number form 1 to 150 as a marker symbol.I have this but it doesn't work.please help
if true
% code
mark=zeros(1,class_length);
for i=1:class_length
mark(:,i)=i;
ma=num2str(mark);
malength=length(ma);
end
if mode==6 && colorflag==0
box on;
hold on;
for i=1:class_length
for p=1:malength
if classlabel(i)==p
plot(x(i),y(i),'Marker',mo(p),'MarkerSize',fontsize,'Color',colors(7));
end
end
end
hold off;
end
Accepted Answer
More Answers (1)
Mischa Kim
on 9 Feb 2014
Edited: Mischa Kim
on 9 Feb 2014
x = 0:1:10;
y = sin(x);
plot(x,y,'-r')
hold on
for ii = 1:length(x)
text(x(ii),y(ii),num2str(ii),'Color','r')
end
3 Comments
shirin
on 9 Feb 2014
Jason Adkins
on 21 May 2020
Ah so easy, thank you!
VIGNESH BALAJI
on 13 Jul 2023
This idea of plotting text in plot is very useful to number data and sorting them out. Thanks :)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!