How to create Stacked Scatter Plot in Matlab?

2.1k views Asked by At

I want to be able to create Stacked Scatter plot. So that same Y-axis and X-axis would be required. Each scatter plot should be at vertical distance from each other. Also all scatter plots should have same Y-axis and I want them to have same y-labels on each interval.

I have tried Subplot but that doesn't give what I want. Anybody have any Ideas?

1

There are 1 answers

4
Luis Mendo On BEST ANSWER

Use some vertical separation?

x  = rand(1,100); %// example x axis data
y1 = rand(1,100); %// example y axis data 1
y2 = rand(1,100); %// example y axis data 2
y3 = rand(1,100); %// example y axis data 3
sep = 2; %// vertical separation

hold all
plot(x, y1, '.')
plot(x, sep+y2, '.')
plot(x, 2*sep+y3, '.')

enter image description here

Or better, use subplot:

subplot(3,1,1)
plot(x, y1, 'r.')
subplot(3,1,2)
plot(x, y2, 'g.')
subplot(3,1,3)
plot(x, y3, 'b.')

enter image description here