Defining sub-groups in gscatter

5 views (last 30 days)
Matteo Jarre
Matteo Jarre on 1 Mar 2016
Commented: Image Analyst on 17 Jun 2017
Hello everybody,
I'm having troubles in correctly using the "gscatter" function; I have three variables 'temp' (a temperature), 'en' (energy) and 'hour' (the hour of the day at which the energy was consumed, given for many different days).
I am able now to use gscatter to plot 'temp' vs. 'en' and visualize the different hours as different colors by simply using
gscatter(temp_h,en,hour);
Since there are 24 hours in a day, the visualization is not optimal. What I now would like to do is to create sub-groups of hours that could be plotted in a single color, e.g. '0 am to 4 am', '5 am to 9 am' and so on...
How could I define such subgroups and have them correctly read by 'gscatter' function? I really can't do this also considering that the third variable of gscatter should have the same length of the two other variables.
Thanks a lot in advance.
All the best.
Matteo
  2 Comments
Mariana
Mariana on 17 Jun 2017
I do have same question. How can I add a colorbar that range, for example, from 0 to 24 hours, in case on the example above. I would appreciate help soon :)
Image Analyst
Image Analyst on 17 Jun 2017
Attach a small sample of your data. Failing to do that, or at least posting a screenshot, may be why no one answered the original question.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!