Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib scatter(): default value for size, marker shape

Is there a way to set default marker size (s) parameter for matplotlib plt.scatter() (or likewise to set the shape of the marker)?

mpl.rcParams.keys() has settings for the line plots, e.g.

import matplotlib as mpl
mpl.rcParams['lines.marker']='D'

... but they do not seem to relate to plt.scatter().

Thanks.

Clarification:

I'd like to use a configuration mechanism like mpl.rcParams(), or some other reasonably civilized method. Locally modifying library code is not it.

On the other hand, if it cannot currently be done and somebody submits a patch to Matplotlib, that would be awesome.

like image 226
Dmitri Avatar asked Oct 04 '15 16:10

Dmitri


1 Answers

Of course there is, it's all in the pyplot.py

A snippet from their code:

def scatter(x, y, s=20, c=None, marker='o', cmap=None, norm=None, vmin=None,
            vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None,
            hold=None, data=None, **kwargs):

The size is set to 20 s=20 and the marker shape is a circle marker='o' which agrees with their documentation

like image 124
Leb Avatar answered Sep 20 '22 03:09

Leb