Python 如何在matplotlib中使行上的标记变小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20048266/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 19:22:29  来源:igfitidea点击:

How to make markers on lines smaller in matplotlib?

pythonmatplotlib

提问by Sibbs Gambling

The documentation on matplotlibmarkers hereteaches 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.

matplotlib此处有关标记的文档告诉我,我可以拥有多种样式的标记。例如,我可能有'-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

我得到

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?

如何使线上的标记变小?

采纳答案by danfish0

You can use markersizeargument 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

像这样

enter image description here

在此处输入图片说明