[英]Matplotlib plot line with empty markers
I'm plotting some data in this way:我正在以这种方式绘制一些数据:
plt.plot(x, data['Coherence'], color='b', marker='.', linestyle='solid', mfc='none', mec='b')
plt.xlabel("Number of Topics")
plt.ylabel("Coherence score")
plt.legend("coherence_values", loc='best')
plt.show()
And the output (correct) is:输出(正确)是:
That is almost what I would like, but behind the markers, I can still see part of the line.这几乎是我想要的,但在标记后面,我仍然可以看到部分线条。 There is a way to get a result like this?
有没有办法得到这样的结果?
Thank you!谢谢!
You can set the markerfacecolor
parameter to "white" to obtain the desired result.您可以将
markerfacecolor
参数设置为“白色”以获得所需的结果。
For instance:例如:
import matplotlib.pyplot as plt
import numpy as np
plt.plot(np.random.randn(10), color='b', marker='.', linestyle='solid', mfc='none', mec='b', markersize=24, markerfacecolor='white')
Yields the following figure:产生下图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.