Matplotlib 绘制虚线圆圈
Matplotlib Plot Dashed Circles
鉴于以下情况:
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(60)
y = np.random.randn(60)
x2 = np.random.randn(60)
y2 = np.random.randn(60)
plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r')
plt.show()
如何仅针对 x 2 和 y2 用虚线圆圈(每个圆圈的轮廓是虚线而不是实线)绘制相同的数据?
提前致谢!
更新:
我知道这可以通过 here 中的补丁来完成,但如果可能的话,我需要通过 plt.scatter 来完成,因为我还将在同一地块上绘制另一组圆圈并使用乱七八糟的补丁图表尺寸(太薄了)。
将 linestyle='--'
传递给 scatter
。
plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r',
linestyle='--')
对于那个标记大小,我宁愿使用 linestyle=':'
。
鉴于以下情况:
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(60)
y = np.random.randn(60)
x2 = np.random.randn(60)
y2 = np.random.randn(60)
plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r')
plt.show()
如何仅针对 x 2 和 y2 用虚线圆圈(每个圆圈的轮廓是虚线而不是实线)绘制相同的数据?
提前致谢!
更新: 我知道这可以通过 here 中的补丁来完成,但如果可能的话,我需要通过 plt.scatter 来完成,因为我还将在同一地块上绘制另一组圆圈并使用乱七八糟的补丁图表尺寸(太薄了)。
将 linestyle='--'
传递给 scatter
。
plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r',
linestyle='--')
对于那个标记大小,我宁愿使用 linestyle=':'
。