11

Is it possible to set the color of the borders of the dots that are generated via the Axes.scatter or is it always black?

thanks!

fstab
  • 4,801
  • 8
  • 34
  • 66

1 Answers1

14

If you want to make all the edges the same color:

ax.scatter(...., edgecolor=EC)

where EC is a color. If you want to surpress the edge (so it looks like the edge color matches the face color) use

ax.scatter(..., linewidths=0)

If you want to have the edges be a different color than the face and each marker have it's own color it looks like you have to do the mapping your self:

my_cmap = cm.get_cmap('jet')
my_norm = matplotlib.colors.Normalize()
ec_data = rand(15)
my_normed_data = my_norm(ec_data)
ec_colors = my_cmap(my_normed_data) # a Nx4 array of rgba value
ax.scatter(rand(15), rand(15), s=500, c=rand(15), edgecolors=ec_colors, linewidth=3)

enter image description here

tacaswell
  • 84,579
  • 22
  • 210
  • 199