[英]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.