Matplotlib 绘制虚线圆圈

问题描述 投票:0回答:1

鉴于以下情况:

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

如何仅针对

x2
y2
绘制相同的数据,用虚线圆圈(其中每个圆圈的轮廓是虚线而不是实线)?

更新: 我知道这可以通过here中的补丁来完成,但如果可能的话,我需要通过

plt.scatter
来完成,因为我还将在同一个图上绘制另一组圆圈并使用与图表尺寸混乱的补丁(太薄了)。

matplotlib google-maps-markers
1个回答
8
投票

linestyle='--'
传递至
scatter

plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.scatter(x2, y2, s=80, facecolors='none', edgecolors='r',
            linestyle='--')

enter image description here

对于标记尺寸,我宁愿使用

linestyle=':'

© www.soinside.com 2019 - 2024. All rights reserved.