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*

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
4
  • 4
    The question was about scatterplot, and in matplotlib the two plotting functions have different parameters (markersize for plot, and s for scatter). So this answer doesn't apply.
    – Dom
    Commented Apr 28, 2017 at 9:19
  • 3
    @Dom I upvoted, because this question pops up as the first result in google even when I search "pyplot plot marker size", so this answer helps.
    – Przemek D
    Commented Jul 26, 2017 at 8:18
  • I know the plot method and the scatter method are different in plt but they both can realize the 'scatter plot' and adjust markersize, so this answer is just another working around if you use plot method @Dom
    – zhaoqing
    Commented Jul 28, 2017 at 5:42
  • scatter can specify colormap.
    – fchen
    Commented Jan 18, 2024 at 17:23