为了账号安全,请及时绑定邮箱和手机立即绑定

Python pandas matplotlib 如何删除图中的类别标签?

Python pandas matplotlib 如何删除图中的类别标签?

素胚勾勒不出你 2023-03-22 17:07:56
# 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)


查看完整回答
反对 回复 2023-03-22
  • 1 回答
  • 0 关注
  • 97 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信