How to group scatter plot data?

1 view (last 30 days)
Rinu
Rinu on 24 Oct 2013
I have three vectors x,y and z of the same length. How can I generate a scatter plot of x and y which is grouped according to the corresponding values of z (e.g. group 1 for z<10, group 2 for 10<=z<20 and group 3 for z>=20)? I'm thinking of using gscatter but for that I have to make a group vector first. Is there any way I can generate a vector "group" which is "1" for z<10, "2" for 10<=z<20 and "3" for z>=20? Any help is much appreciated.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!