简单绘图,python实现
程序员文章站
2022-03-19 09:57:04
...
Python数据处理从零开始----第四章(可视化)(1)Matplotlib包 :https://www.jianshu.com/p/c07723faf5d7
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
### 画图
#import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv("./HR.csv", header=0)
plt.title("SALARY")
plt.xlabel("salary")
plt.ylabel("Number")
#plt.xticks("刻度","刻度标签")
plt.xticks(np.arange(len(df["salary"].value_counts())), df["salary"].value_counts().index)
plt.bar(np.arange(len(df["salary"].value_counts())), df["salary"].value_counts(), width=0.5)
plt.text(1, 7318,7318,ha="center", va="bottom")
plt.show()