categorical scatter plot change colors of points within group

4 次查看(过去 30 天)
Hello,
I'm attempting to create a categorical scatter plot with individual RGB color codes assigned to individual points. In addition, I would love to have different marker shapes applied to each category. I am currently using UnivarScatter https://www.mathworks.com/matlabcentral/fileexchange/54243-univarscatter from the file exchange and cannot figure out how to make this happen; this code treats each category as a group and I cannot change colors of individual points even when I go into figure properties. Does anyone know a way around this or another categorical scatter plot that allows me to assign RGB codes by row?
Thank you!
  4 个评论
Manuel Lera Ramírez
Hello Emily. I replied to your question in the forum of the function.I dont know what you mean exactly by "by row", but if you have a look at the example, you can see that the function outputs the x and y coordinates of the dots on each group.
If I correctly understand what you mean, this could do the trick:
% Some random data
a = rand(5,1);
b = rand(5,1);
data = [a,b];
% Some rgb assigned to each row
my_rgb = [1 0 0; 0 0 1; 0 1 0; 1 1 0; 0 0 1];
% Draw the plot
[x,y] = UnivarScatter(data);
% Put hold
hold on
% Draw coloured points on top of the plot
scatter(x(:,1),y(:,1),[],my_rgb,'filled')
Hope its helpful
Walter Roberson
Walter Roberson 2018-8-16
If the color is not intended to be consistent per category, that what is intended to be graphically consistent per category but different from category to category? Marker shape? Font size? Transparency? Z coordinate? Marker size? Marker edge color?

请先登录,再进行评论。

回答(0 个)

类别

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