How to make 2D scatter plot in Matlab with colors depending on values? -
i have 3 vectors of same lenght: x
, y
, , cls
. want create 2d plot of x , y each point should have color corresponding value of cls
.
i thought using scatter
function can chage color of whole plot, not of particular elements. ideas?
i in example, when cls
has elements of 3 values:
from help of scatter:
scatter(x,y,a,c) specifies circle colors. plot circles same color, specify c single color string or rgb triplet. utilize varying color, specify c vector or three-column matrix of rgb triplets.
you can build c
c=zeros(size(x),3); c(cls==1,:)=[1 0 0]; % 1 reddish % ... scatter(x,y,1,c)
however, dont know how background. did apply machine learning algorithm clasify data? maybe can equations plot background there, depends on method.
matlab plot
No comments:
Post a Comment