MATLAB: Different colors for a gscatter plot (RGB triplets)

gscatterrgb triplet

Hi all,
I'm a beginner in Matlab and I have an issue with the gscatter function.
I need to do a figure similar to that one, but i would like to use different colors, defined by the RGB triplet (for instance [0.5 0.1 0.8])
Here a part of the code. It works, but I can't use the RGB triplet, but only the standard colores defined by rgby…..any suggestion? I would need to use seven different RGB triplets. Thank you
col='rgbymck'
g= gscatter(x,y,order,col,'o');
for n = 1:length(g)
set(g(n), 'MarkerFaceColor', col(n));
end
for n = 1:length(g)
set(g(n), 'MarkerEdgeColor', 'k');
end
xlim([30 70])..
hold on
m= gscatter(x2, y2, order2,col,'^');
for n = 1:length(m)
set(m(n), 'MarkerFaceColor', col(n));
end
for n = 1:length(m)
set(m(n), 'MarkerEdgeColor', 'k');
end
xlim([30 70])

Best Answer

Hi,
RGB triplets can be used - see here. Therefore activate the filled option.
Best regards
Stephan