# Example Python program to plot a complex bar chart import pandas as pdimport matplotlib.pyplot as plot # A python dictionarydata = {"Car Price":[24050, 34850, 38150], "Kerb Weight":[3045, 3572, 3638] };index = ["Variant1", "Variant2", "Variant3"]; # Dictionary loaded into a DataFrame dataFrame = pd.DataFrame(data=data, index=index); # Draw a vertical bar chartdataFrame.plot.bar(rot=15, title="Car Price vs Car Weight comparision for Sedans made by a Car Company");plot.show(block=True);此代碼來(lái)自https://pythontic.com/pandas/dataframe-plotting/bar%20chart我會(huì)得到的結(jié)果是如何刪除左上角的類別框?
1 回答

小怪獸愛吃肉
TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超1個(gè)贊
將倒數(shù)第二行更改為此以刪除圖例:
dataFrame.plot.bar(rot=15, title="Car Price vs Car Weight comparision for Sedans made by a Car Company", legend=False)
添加回答
舉報(bào)
0/150
提交
取消