【发布时间】:2020-02-19 06:49:38
【问题描述】:
我在 Jupyter Notebook 中的 Seaborn 中有一个奇怪的行为。我画了一个bloxplots列表,它打印得很好:
sns.boxplot(
data=df_enem, y='CO_ESCOLA', x='nota_final', orient='h',
order=df_melhores.head(NUM_MELHORES).CO_ENTIDADE)
现在我打印完全相同的图表,但是获取并设置了yticks,并且图形边距搞砸了:
ax = sns.boxplot(data=df_enem, y='CO_ESCOLA', x='nota_final', orient='h',
order=df_melhores.head(NUM_MELHORES).CO_ENTIDADE)
locs, labels = plt.yticks()
plt.yticks(locs, labels);
如果我打印 locs 和 labels 变量,我会得到:
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39] <a list of 40 Text yticklabel objects>
同样的问题出现在图的底部。
有什么办法可以解决这个问题?
【问题讨论】:
-
降级到 3.1.0 解决了这个问题。
标签: matplotlib seaborn