# -*- coding: utf-8 -*-
"""
Created on Sun Jun 9 17:14:15 2019
@author: User
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
salary=pd.read_csv(u'data\\ch5\salary.csv',encoding = "gbk")
'''
参数1:数据
参数2:盒子形状,0表示默认矩形,1表示凹形
参数3:异常值数据标志的形状,如r rs
参数4:绘制水平盒须图
'''
plt.boxplot(salary['salary'],1,'r',0,labels=['current salary'])
plt.title('salary of enterprises')
plt.show()
运行:
不同数据对比分析:
plt.boxplot([salary['salary'],salary['begin_salary']])
plt.title('salary of enterprises')
combinebox=plt.subplot(111)
combinebox.set_xticklabels(['current salary','begin_salary'])
plt.show()
运行: