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

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

mpl.rcParams.keys() has parameters for line graphs, for example

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

... but they don't seem to apply to plt.scatter() .

Thanks.

Clarification:

I would like to use a configuration mechanism like mpl.rcParams() or some other reasonably civilized method. Modifying library code locally is not the case.

On the other hand, if this is not possible, and someone sends the patch to Matplotlib, that would be awesome.

+5
source share
2 answers

Of course there is everything in pyplot.py

Code excerpt:

 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 shape of the marker is a circle marker='o' , which is consistent with their documentation

0
source

In the current version, matplotlib is not possible ( http://matplotlib.org/users/customizing.html ).

However, it is possible to change the default marker in the main branch to GitHub ( https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/rcsetup.py#L1112 ).

0
source

Source: https://habr.com/ru/post/1232910/


All Articles