MATLAB: Scatter plot of 2 colors with X Y and Z data- Z (0 and 1) color scatter with 2 colors only I have 3 column vectors X Y and Z. Z is parameter 0 or 1 I wish to plot scatter plot of Z at respective (X,Y) with 2 colors to signify either 0 or 1. I shall be grateful for any help………… Best Answer N = 100 ;x = rand(N,1) ;y = rand(N,1) ;z = rand(N,1) ;idx1 = (z<0.5) ;idx2 = (z>0.5) ;scatter(x(idx1),y(idx1),25,'r','filled');hold onscatter(x(idx2),y(idx2),25,'b','filled');legend('red z < 0.5', 'blue z > 0.5'); Related SolutionsMATLAB: How to insert an arrow symbol in legend [X,Y,Z] = peaks; figure [~,L3]= contour(X,Y,Z,10,'r'); hold on q = 0; L1= plot (xlim,[1 1]*q,'LineWidth',2); tes=L1.Color L1.Color='blue' a=0 L2= plot ([1 1]*a,ylim,':k','LineWidth',2); L4 = quiver(10,10,1,0,'b'); lgd=legend([L2 L3 L4],{'threshold','contour','arrow'},... 'location','northeast') lgd.FontSize = 15; axis([-3 3 -3 3]) MATLAB: Plotting a graph with different size markers Read about scatter. Related QuestionZ=xyResult of z+conj(z) and z*conj(z) with z complex by defaultInverse z-TransformRank the point in scatter3d figure with different color
Best Answer