Increase size of symbols in the matplotlib legend?

亡梦爱人 提交于 2021-01-24 07:14:11

问题


I draw a plot with markers like so:

plt.scatter(xs1, ys1, s=12, linewidths=0, marker='o', label='hello')
plt.scatter(xs2, ys2, s=12, linewidths=0, marker='x', label='hello')

this produces the right size in the graph, but the symbols are hardly intelligible in the legend. How can I increase the size of the symbols in the legend?


回答1:


I found the solution in matplotlib.pyplot.legend. The legend takes an attribue 'markerscale'.

plt.legend(loc='best',markerscale=2)


来源:https://stackoverflow.com/questions/49800496/increase-size-of-symbols-in-the-matplotlib-legend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!