# 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);此代码来自https://pythontic.com/pandas/dataframe-plotting/bar%20chart我会得到的结果是如何删除左上角的类别框?
1 回答
小怪兽爱吃肉
TA贡献1852条经验 获得超1个赞
将倒数第二行更改为此以删除图例:
dataFrame.plot.bar(rot=15, title="Car Price vs Car Weight comparision for Sedans made by a Car Company", legend=False)
添加回答
举报
0/150
提交
取消