Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib scatter marker size

I'm trying to plot a 3D scatter with matplotlib The problem is that I can't change the marker's size I have this

scat = plt.scatter([boid_.pos[0] for boid_ in flock],
                   [boid_.pos[1] for boid_ in flock],
                   [boid_.pos[2] for boid_ in flock], 
                   marker='o', s=5)

But I get the error

TypeError: scatter() got multiple values for keyword argument 's'

Without that, the plot works fine. Where is the problem? Or is there another way to change the size?

like image 527
PerroNoob Avatar asked Oct 18 '13 13:10

PerroNoob


1 Answers

This function takes in two args before the keyword args:

scatter(x, y, s=20, ...)

And you are passing in three, so you are specifying s twice (once implicitly and once explicitly).

Actually, I think you are trying to use the 2D scatter plot function instead of a 3D one. You probably want to do this instead:

from mpl_toolkits.mplot3d import Axes3D
Axes3D.scatter( ... )
like image 85
wim Avatar answered Sep 21 '22 22:09

wim