Python matplotlib 条形图黑色 - 如何删除条形边框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15904042/
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 21:20:27  来源:igfitidea点击:

matplotlib bar graph black - how do I remove bar borders

pythongraphmatplotlibborder

提问by user1893354

I'm using pyplot.bar but I'm plotting so many points that the color of the bars is always black. This is because the borders of the bars are black and there are so many of them that they are all squished together so that all you see is the borders (black). Is there a way to remove the bar borders so that I can see the intended color?

我正在使用 pyplot.bar 但我绘制了很多点,以至于条的颜色总是黑色。这是因为条形的边界是黑色的,而且条形太多了,以至于它们都被挤压在一起,所以您只能看到边界(黑色)。有没有办法删除条形边框,以便我可以看到预期的颜色?

采纳答案by Robbert

Set the edgecolorto "none": bar(..., edgecolor = "none")

设置edgecolor"none"bar(..., edgecolor = "none")

回答by dbliss

Another option is to set edgecolorto be the intended color in your call to bar:

另一种选择是设置edgecolor为您调用中的预期颜色bar

# If your intended color is blue, this will work:
bar(. . . , edgecolor='b')