繁体   English   中英

熊猫可视化表中的标签

[英]Labels in table of visualization of Pandas

嗨,我正在绘制一个熊猫数据框。 熊猫数据框如下所示:

;Cosine;Neutralized
author;0.842075;0.641600
genre;0.839696;0.903227
author+genre;0.833966;0.681121

我正在使用的绘图代码是:

fig = ari_total.plot(kind="bar", legend = False, colormap= "summer",
                     figsize= ([7,6]), title = "Homogeinity "+corpora+" (texts: "+str(amount_texts)+")", table=True,
                    use_index=False, ylim =[0,1]).get_figure()

结果不错,但是有一个问题: 在此处输入图片说明

如您所见,表“ author”,“ genre”和“ author + gender”的索引中的实验在0、1和2上呈现。

我的问题:如何删除此数字并仍然使用相同的功能? 我正在使用参数use_index = False,我以为他们会从条形图中删除标签,但实际上只用这个数字替换了它们。

如果您能帮助我,我将非常感激。 问候!

使用fig.axes[0].get_xaxis().set_visible(False)

码:

import pandas as pd
import matplotlib.pyplot as plt

df = pd.DataFrame()
df['Cosine'] = [0.842075,0.839696,0.833966]
df['Neutralized'] = [0.641600,0.903227,0.681121]
df.index = ['author', 'genre', 'author+genre']
fig = df.plot(kind="bar", legend = False, colormap= "summer",
                     figsize= ([7,6]), title = "whatever", table=True,
                    use_index=False, ylim =[0,1]).get_figure()
fig.axes[0].get_xaxis().set_visible(False)
plt.show()

结果:

在此处输入图片说明

暂无
暂无

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

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