Use*_*YmY 2 python matplotlib legend scatter-plot pandas
我有一个散点图:
fig,ax = plt.subplots(figsize=(6,5),dpi=200)
ax.scatter(df1['id'],df1['resellers'],c='red',s=df1['ips']/80,label='AS Size = IPs seen in dnsdb')
ax.set_xticks([1,2,4,6,8,10,12,14,16,18,20])
ax.set_xlim(-1,22)
ax.legend(
scatterpoints=1,
loc='best',
ncol=1,
fontsize=12)
Run Code Online (Sandbox Code Playgroud)
我想知道如何将图例中气泡的形状和大小更改为矩形和更小的尺寸.有人可以帮忙吗?
您可以使用markerscale关键字更改图例中符号的大小.例如,
ax.legend(
scatterpoints=1,
loc='best',
ncol=1,
markerscale=0.5,
fontsize=12)
Run Code Online (Sandbox Code Playgroud)
将符号大小减少2倍.
| 归档时间: |
|
| 查看次数: |
3842 次 |
| 最近记录: |