Reputation: 8554
I have a scatter plot :
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)
I am wondering how can I change the shape and size of the bubble in the legend to rectangular and smaller size. Can anybody help?
Upvotes: 3
Views: 7661
Reputation: 15433
You can change the size of the symbol in the legend using the markerscale
keyword. For example,
ax.legend(
scatterpoints=1,
loc='best',
ncol=1,
markerscale=0.5,
fontsize=12)
will reduce the symbol size by a factor 2.
Upvotes: 7