Is it possible to do multiple array of data on the same scatter plot;
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Md. Hasan Rahman
am 13 Mai 2019
Kommentiert: Md. Hasan Rahman
am 14 Mai 2019
I have a function like:
m=zeros(3,4)
for x=1:3
for y=1:4
m(x,y)=x*(y+1i*y);
end
scatterplot(m(x,:));
hold on;
end
Although i used "hold on" but Its generating three different plots. Can I plot all three different data in the same plot with different color?
0 Kommentare
Akzeptierte Antwort
gonzalo Mier
am 13 Mai 2019
Scatterplot is a really special function that needs a special syntax to plot more that one scatterplot together.
m =zeros(3,4);
first=1;
for x=1:3
for y=1:4
m(x,y)=x*(y+1i*y);
end
if first
h = scatterplot(m(x,:),1,0,'bo');
first=0;
else
h = scatterplot(m(x,:),1,0,'bo',h);
end
hold on;
end
3 Kommentare
gonzalo Mier
am 14 Mai 2019
The 'bo' param is used to mark the points to be blue('b') circles ('o'). To change the color you can use the normal ones as you do it with plot ('r' = red, 'b' = blue, 'g' = green, 'k' = black...)
m =zeros(3,4);
first=1;
color = ['r','g','b'];
for x=1:3
for y=1:4
m(x,y)=x*(y+1i*y);
end
if first
h = scatterplot(m(x,:),1,0,color(x));
first=0;
else
h = scatterplot(m(x,:),1,0,color(x),h);
end
hold on;
end
Weitere 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!