How to make markers on lines smaller in matplotlib?

Question:

The documentation on matplotlib markers here teaches me I can have several styles of the markers. For example, I may have '-o' for circles on the line, '-*' for stars on the line and '-s' for square on the line.

However, they all appear to be too big for me. Like, when I do

axes.errorbar(x, y, yerr=ci, fmt='-o', color='k')

I get

enter image description here

To make them smaller, I tried

axes.errorbar(x, y, yerr=ci, fmt='-o', s=1, color='k')

but no luck.

How to make the markers on a line smaller?

Asked By: Sibbs Gambling

||

Answers:

You can use markersize argument to change the size of the markers:

plt.errorbar(x, y, yerr=err, fmt='-o',  markersize=2, color='k', label = 'size 2')

Like so

enter image description here

Answered By: dnf0

just so you won’t waste time
for scatter plot the keyword for size is s and not markersize

plt.scatter(x, y, s=20, c=colors, alpha=0.5)

but you can still use the marker shape if you want

source:
matplotlib’s scatter documentation

Answered By: sivi
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.