当edgecolor ='none'时,Matplotlib标记消失 [英] Matplotlib markers disappear when edgecolor = 'none'
问题描述
我正在尝试绘制一些PCA数据的散点图.我做了一些非常典型的代码:
I'm trying to make a scatter plot of some PCA data. I do some pretty typical code:
plt.plot(pca[:,0], pca[:,1], '.',ms=3, markerfacecolor = self.colors[k],
markeredgecolor = 'none')
我希望它只显示没有轮廓的标记面颜色.问题是当markeredgecolor = 'none' 时,标记完全消失.当我将markerfacecolor ='none'或设置为一种颜色并删除markeredgecolor时,它的工作原理与预期的一样.
I want it to show just the marker face color with no outline. The problem is that the markers disappear completely when markeredgecolor = 'none'. When I set markerfacecolor='none' or to a color and remove markeredgecolor, it works like expected.
我刚刚将 matplotlib、numpy 等更新为最新版本,在 Python 2.7 上运行.
I just updated matplotlib, numpy, etc. to the newest versions, running on Python 2.7.
感谢您的帮助.
推荐答案
我认为这是几个月前修复的错误:https://github.com/matplotlib/matplotlib/pull/598
I think this is a bug that was fixed a few months ago: https://github.com/matplotlib/matplotlib/pull/598
无论您制作多大的标记,或者如果使用 marker ='o'
代替'.'
,如果您使用markeredgecolor='none'
.
Regardless of how large you make the markers or if you use marker='o'
instead of '.'
, they'll be invisible if you use markeredgecolor='none'
.
作为解决方法,您可以将边缘颜色设置为与面部颜色相同.
As a workaround, you can just set the edge colors to the same as the face colors.
这篇关于当edgecolor ='none'时,Matplotlib标记消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!