简体   繁体   English

如何在 matplotlib 中使线条上的标记变小?

[英]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.

相关问题 Matplotlib 3d 绘制如何使标记更小以便 object 形状可以看作是线框? - Matplotlib 3d plotting how to make markers smaller so object shape can be seen like a wireframe? 如何在 Matplotlib 中制作数字? 粗水平线作为标记,两端通过虚线连接 - How to make figure in Matplotlib? Thick horizontal lines as markers with ends connected through dashed lines 在matplotlib中向colorbar添加标记或线条 - Adding markers or lines to colorbar in matplotlib 如何使用matplotlib删除/省略较小的轮廓线 - How to remove/omit smaller contour lines using matplotlib 在熊猫中使用 matplotlib 绘制散点图时如何将标记与线条连接起来 - how to connect markers with lines when drawing scatterplots using matplotlib in the pandas 如何在 matplotlib plot 循环中为标记和线条设置相同的颜色? - How to set same color for markers and lines in a matplotlib plot loop? 如何以简单的方式使 matplotlib 标记对色盲友好? - How to make matplotlib markers colorblind-friendly in a simple way? 如何使用matplotlib使两个标记在图例中共享相同的标签? - How to make two markers share the same label in the legend using matplotlib? python + matplotlib:如何让XTick Markers在轴上对称? - python + matplotlib: How to make XTick Markers symmetric over the axis? 如何使用 matplotlib 在两条单独的 plot 行上的标记之间创建新行 plot? - How to plot a new line between the markers on two separate plot lines using matplotlib?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM