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
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?
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
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
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
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?
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
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