categorical scatter plot change colors of points within group

조회 수: 8 (최근 30일)
Emily Pendleton
Emily Pendleton 2018년 8월 15일
댓글: Walter Roberson 2018년 8월 16일
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
Manuel Lera Ramírez 2018년 8월 16일
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에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by