plot of markers, having different color in one line of code.

1 vue (au cours des 30 derniers jours)
mikkel stær
mikkel stær le 14 Mar 2021
hi why can i not do the following. when it follows the rules from the "plot" command sytax
i want one line and write plot one time, with all the information inside.
since i already know that i could just write them seperately.
plot(x2,y2,".",'MarkerFaceColor',[0.500 0.3250 0.0500], "Markersize",20,x3,y3,".",'MarkerFaceColor',[0.8500 0.3250 0.0980], "Markersize",20)
or
plot(x2,y2,".",'MarkerFaceColor',[0.500 0.3250 0.0500],x3,y3,".",'MarkerFaceColor',[0.8500 0.3250 0.0980], "Markersize",20)
is there a way to nest with () or [] or {} pls help.

Réponse acceptée

ANKUR KUMAR
ANKUR KUMAR le 15 Mar 2021
x2=[1,3];
y2=[3,4];
x3=[3,4,5];
y3=[1,6,7];
cell_values={x2,y2;x3,y3};
col_vals={[0.500 0.3250 0.0500],[0.8500 0.3250 0.0980]};
for kk=1:size(cell_values,1)
plot(cell_values{kk,1},cell_values{kk,2},'kd','MarkerFaceColor',col_vals{kk})
hold on
end

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by