繁体   English   中英

在 matplotlib 中未出现带有堆积条形图的刻度

[英]Ticks not appearing with a stacked bar chart in matplotlib

我在 matplotlib 中有一个堆积条形图,除了在 plot 中看不到 xticks 之外,它的效果很好。

fig, axes = plt.subplots(6, 1, sharex=True, figsize=(20, 10), subplot_kw=dict(frameon=True))

n = 6

i=0
for lineage, j in zip(['a', 'b', 'c', 'd', 'e', 'f'], axes.flatten()):
    x=list(map(lambda x: int(x.strip()[1:-1]), lineage_snp[lineage].value_counts().index))
    y=list(lineage_snp[lineage].value_counts().values/lin_counts[lineage])
    j.bar(x, y, label = lineage, alpha=1, width=100, color = colors[lineage])
    j.legend(loc = 'upper left')
    j.grid(True)
    plt.subplots_adjust(hspace=.0)
    i+=1
   
plt.xticks(rotation=0)
plt.show()

我在这里想念什么? 如果我保持网格打开,我可以获得刻度线应该在的网格,但我更喜欢关闭网格,并且在 label 上只出现一个刻度线。

想通了。 我正在使用风格seaborn-whitegrid ,在更改为seaborn-ticks时,蜱虫很好。

暂无
暂无

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

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