简体   繁体   English

matplotlib条形图填充黑色纹理

[英]matplotlib bar plot fill with black texture

How to fill black texture to distinguish bars not use color in matplotlib? 如何填充黑色纹理以区分在matplotlib中不使用颜色的条形? I can't find any example. 我找不到任何例子。 just like this texture in R 就像R中的这个纹理

The matplotlib.pyploy.bar object has the property hatch , which controls the kind of thing you are after. matplotlib.pyploy.bar对象具有hatch属性,该属性控制您所需要的东西。

Check out the doc for more info https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.bar.html 查看文档以获取更多信息https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.bar.html

There is a really nice example of this in the matplotlib docs. matplotlib文档中有一个非常好的示例。 https://matplotlib.org/examples/pylab_examples/hatch_demo.html https://matplotlib.org/examples/pylab_examples/hatch_demo.html

You may need to tweak the example to match your specific neads though. 但是,您可能需要调整示例以匹配您的特定需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM