[英]How to make markers on lines smaller in matplotlib?
The documentation on matplotlib
markers here teaches me I can have several styles of the markers.此处关于
matplotlib
标记的文档告诉我,我可以拥有多个 styles 标记。 For example, I may have '-o'
for circles on the line, '-*'
for stars on the line and '-s'
for square on the line.例如,我可能用
'-o'
表示直线上的圆圈, '-*'
表示直线上的星星,“- '-s'
表示直线上的正方形。
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: 您可以使用
markersize
参数来更改标记的大小:
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
这样你就不会浪费时间分散 plot 大小的关键字是
s
而不是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来源: matplotlib 的散点图文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.