Color different marker style according to different variables

13 次查看(过去 30 天)
Hi,
I'm fresh to matlab! I am aiming to include 4 variables consisting on (130x1 double) on a scatter plot. So far I have used gscatter function, with which i am able to plot 2 variable (x,y) colored and/or symboled according to a variable (g). This is the figure i get and the plotting part of my code (i have a long code where i define different variables):
col='ymcrgbk'
gscatter(MgOMI, LaYbMI, localityMI, col,'*odphvx',8)
untitled.jpg
I like the outcome, but i also would like to use a 4th variable to determine the color of each marker set. The 4th variable would again be (130x1 double) and i would like to color the different symbols accoriding to that 4th variable.
I know how to do that using the scatter function, but with scatter i cannot distinguish my samples in different groups. Also, i might need to add error bars on that plot...but let's proced step by step.
Any hint?
Thank you
A.

回答(1 个)

Image Analyst
Image Analyst 2020-1-9
It looks like (though I haven't tried it) that you can use the 'clr' option of gscatter to specify what color each group is.
  1 个评论
Alberto Caracciolo
Alberto Caracciolo 2020-1-10
Yes, i can use the clr option, but i only can set up a default color, like black, yellow....I have a 4th variable that i want to use to color the markers (and set up a color map eventually). It is not a single color for each group, but it will depend on the variable.
Again scatter function allows me to color the data according to a variable, but i cannot distingush the data in groups....gscatters allows me to divide the data in groups but not to color the data according to an additional variable.....

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by