Different colors for a gscatter plot (RGB triplets)
Show older comments
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])
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!