gpt4 book ai didi

python - 带有空标记的 Matplotlib 绘图线

转载 作者:行者123 更新时间:2023-12-02 00:05:25 26 4
gpt4 key购买 nike

我正在以这种方式绘制一些数据:

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()

输出(正确)是: Text

这几乎是我想要的,但在标记后面,我仍然可以看到部分线。有办法得到这样的结果吗?

enter image description here

谢谢!

最佳答案

您可以将 markerfacecolor 参数设置为“白色”以获得所需的结果。

例如:

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')

产生下图:

enter image description here

关于python - 带有空标记的 Matplotlib 绘图线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60794030/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com