我绘制了一个带有性别的海生计数图,其中包含两个类别(1:男性,2:女性)
fig01 = sb.countplot(x = df.gender.values)
fig01.set_xticklabels(['Male', 'Female'])
fig01.set_yticklabels(['{}M'.format(int(num)) for num in fig01.get_yticks()/1e6]);
代码后面会出现一条警告
<ipython-input-36-4627ceab9a45>:4: UserWarning: FixedFormatter should only be used together with FixedLocator
fig01.set_yticklabels(['{}M'.format(int(num)) for num in fig01.get_yticks()/1e6]);
然而,countplot看起来不错
我找到了类似问题here的相关答案。帖子中的指南确实提到我需要先处理set_yticks()
,然后再处理set_yticklabels()
。我很好奇为什么尽管我手动将x_ticklabels()
更改为['Male', 'Female]
,但没有针对set_xticks()
的警告消息
目前没有回答
相关问题 更多 >
编程相关推荐