Customized Markers Edge and Face Colours of a scatter plot SEPARATELY
35 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How can I customize separately Markers Face and Edge Color of scatter points?
I need to have my markers (circles) each one having different Face and Edge colors based on the value of a feature of each point (as showed in the attached file)
These are my scatter lines:
col=M_mrkEdgecol(M_Pts,i);
s=scatter(M_Pts(:,2),M_Pts(:,1),sz,col,'filled')
Facecol=s.CData;
s.CData=M_mrkcol(M_Pts,i);
M_mrkEdgecol(M_Pts,i) define colors of markers' edge and M_mrkcol(M_Pts,i) define the color of markers' face, both three-column matrix with raws colours defined on the base of values of feature of the specific point. These two matrices are obviously different one from the other.
If only col, without 'filled', draw me the right edge colors of my scatter points, else if I add 'filled' option MarkerFaceColor property of the Scatter object is setted to 'flat', the right ones I defined in CData property, but MarkerEdgeColor property is automaticly and stupidly setted to 'none', so I definitely see only the faces colour.
How can I see both faces and edges according to my definitions?
And show it in a legend (as in the attached files)? (may be I have to ask it in another post?!)
1 comentario
Respuestas (1)
Kevin Holly
el 29 de Sept. de 2022
load hospital
hospital
x = hospital.Age;
y = hospital.Weight;
g = {hospital.Sex,hospital.Smoker};
h=gscatter(x,y,g,'gbmc','hhdd',8,'on','Age','Weight');
h(1).MarkerFaceColor = [1 0 0];
h(1).LineWidth = 1;
h(2).MarkerFaceColor = [0 1 1];
h(2).LineWidth = 0.75;
h(3).MarkerFaceColor = [1 1 0];
h(3).LineWidth = 1;
h(4).MarkerFaceColor = [1 0 1];
h(4).LineWidth = 1;
legend('Location','northeastoutside')
0 comentarios
Ver también
Categorías
Más información sobre Visual Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!