gpt4 book ai didi

python - 如何在不返回并更改数据的情况下更改 seaborn fiddle 图的 x 轴标签?

转载 作者:行者123 更新时间:2023-12-05 07:03:27 25 4
gpt4 key购买 nike

我有以下 seaborn fiddle 情节:

sns.violinplot( x=c1_census['Cluster Labels'], y=c1_census['Land Area (km2)'],palette=my_pal)
plt.show()

enter image description here

如何在不返回并更改数据的情况下更改 x 轴的标签。例如:

替换0为A,1 为 B,2为C,3为D,4 代表 E

提前致谢!

最佳答案

您可以使用ax.set_xticklabels:

ax = sns.violinplot( x=c1_census['Cluster Labels'], y=c1_census['Land Area (km2)'],palette=my_pal)
ax.set_xticklabels([*'ABCDE'])

关于python - 如何在不返回并更改数据的情况下更改 seaborn fiddle 图的 x 轴标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63211830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com