views:

1694

answers:

3

Hey all, I have 2 sets of data (Ax, Ay; Bx, By) - I'd like to plot both of these data sets on a scatter plot with different colors, but can't seem to get it to work because it seems scatter() does not work like plot(). Is it possible to do this?

I've tried...

scatter(Ax, Ay, 'g', Bx, By, 'b')

And

scatter(Ax, Ay, 'g')
scatter(Bx, By, 'b')

The first way returns an error. The latter only plots the Bx/By data.

Many thanks!

+5  A: 

Did you try using hold on with the second example?

Qtax
That did the trick! Many thanks for the speedy and concise response. Much appreciated!
Mark
A: 

Another option is to use gscatter. The parameters are different, but it is sometimes more useful than scatter(...); hold on; scatter(...);

Michael Kopinsky
A: 

plot (ax,ay,'g.') generates a scatter plot with green dots

if you want bigger circles, you can use

plot (ax,ay,'g.', 'MarkerSize', XX) %XX = 20 or whatever

To make open circles

plot (ax, ay, 'go')

As you know, plot can be chained, so you can do it one go with

plot (ax, ay, 'go', bx, by, 'bo')

The difference between plot and scatter is that scatter lets you specify the marker size, but you're not asking to do that here.

Marc

related questions