Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

pyplot scatter plot marker size

In the pyplot document for scatter plot:

matplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
                              vmin=None, vmax=None, alpha=None, linewidths=None,
                              faceted=True, verts=None, hold=None, **kwargs)

The marker size

s: size in points^2. It is a scalar or an array of the same length as x and y.

What kind of unit is points^2? What does it mean? Does s=100 mean 10 pixel x 10 pixel?

Basically I'm trying to make scatter plots with different marker sizes, and I want to figure out what does the s number mean.

Answer*

Cancel
3
  • 1
    Wondering how would one calculate what s parameter to give to scatter to get a circle which covers diameter of, let's say, 0.1 in real coordinates of the plot (so as to fill the gap between let's say 0.4 and 0.5 on a plot from (0,0) to (1,1)? Commented Dec 26, 2018 at 19:56
  • @AnatolyAlekseev That should be answered by this question. Commented Feb 17, 2019 at 4:28
  • @ImportanceOfBeingErnest could you pls explain how to get the radius of a scatter based on the s param passed? I thought it is np.sqrt(s)/2. stackoverflow.com/q/64399664/9900084
    – steven
    Commented Oct 17, 2020 at 15:46