简体   繁体   English

如何更改图例中的行数?

[英]How to change number of rows in legend?

I'm trying to create a scatter plot, but the auto-created legend is out from range (0...100). 我正在尝试创建散点图,但是自动创建的图例超出范围(0 ... 100)。 120% label in legend . 图例中有120%的标签

sns.scatterplot(data=df1,x='x',y='y',hue='percent',ax=ax1)

I tried to pass list of labels: 我试图传递标签列表:

plt.legend(labels=[0.0,0.25,0.5,0.75,1.0])

But it still doesn't look good: 但这看起来仍然不好:

链接

Matplotlib's colorbar is a great way to depict a range of values on a scatterplot. Matplotlib的颜色栏是在散点图上描述一系列值的好方法。 Example . 例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM