Is it possible to do multiple array of data on the same scatter plot;

Md. Hasan Rahman

Md. Hasan Rahman (view profile)

님이 질문을 제출함. 13 May 2019
최근 활동 Md. Hasan Rahman

Md. Hasan Rahman (view profile)

님이 댓글을 추가함. 14 May 2019
gonzalo Mier

gonzalo Mier (view profile)

님이 답변을 채택함.
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?

로그인 to comment.

답변 수: 1

gonzalo Mier

gonzalo Mier (view profile)

님의 답변 13 May 2019
채택된 답변

Scatterplot is a really special function that needs a special syntax to plot more that one scatterplot together.
If you need more info I used this, and I add an example of how you can plot some figures 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

Md. Hasan Rahman

Md. Hasan Rahman (view profile)

14 May 2019
Thank you. It is working good. But what should I do for each of array in scatter plot will have different color or marker?
gonzalo Mier

gonzalo Mier (view profile)

14 May 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
Md. Hasan Rahman

Md. Hasan Rahman (view profile)

14 May 2019
I got it thank you.

로그인 to comment.