categorical scatter plot change colors of points within group
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Manuel Lera Ramírez
am 16 Aug. 2018
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
am 16 Aug. 2018
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?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!