Im faced with a problem where i need to plot a two dimensional data with different colors and markers.
We are given with 2 array, namely points (n x 2 dimension) and Label (n x 1 dimension). Im not sure about the number of unique values in the Label array but maximum could be 10. I would like to plot the points with different color and markers based on its corresponding Label value.
Can any one help me in this regard
Use
gscatter, which does a scatter plot, using a group (Labelin your case) to plot in different colours/makers.So you can specify colours like
'rgcmykwb'to do red for the first group, green for the second, etc or[]just to have Matlab sort it out.By default Matlab uses the same marker for each group, so you need to specify what markers you want to be used for each group. If you do
'.ox+*sdv^<>ph'you’ll just cycle along all the markers that Matlab has.It looks a bit like this:
