hi, how can i use legend with my specific colors and Depth in this code?
figurefor n = 1:length(Lon) if Depth(n,1)>=0 && Depth(n,1)<=20 jj = [0 1 0]; elseif Depth(n,1)>20 && Depth(n,1)<=40 jj = [0 1 1]; elseif Depth(n,1)>40 && Depth(n,1)<=60 jj = [0 1 0]; elseif Depth(n,1)>60 && Depth(n,1)<=90 jj = [1 0 0]; elseif Depth(n,1)>90 && Depth(n,1)<=10000 jj = [0 0 0]; endh(n) = plot(Lon(n,1),Lat(n,1),'o','MarkerFaceColor',jj,'MarkerEdgeColor','k'); hold onlegend('0-20','20-40','40-60','60-90','90-10000');end
Best Answer