1.X轴修改问题
导入需要的安装包
import pandas as pd
import numpy as np
#设置画图风格与图片中文字体
from matplotlib import pyplot as plt
plt.style.use("ggplot")
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
#显示所有列
pd.set_option('display.max_columns', None)
#显示所有行
pd.set_option('display.max_rows', None)
#设置value的显示长度为100,默认为50
pd.set_option('max_colwidth',100)
读取excel文件
data1=pd.read_excel("毕业生数.xls")
data1.head()
定义指标
year_group = data1.groupby('指标').sum()
year_group
输出图片
plt.figure(figsize=(10,5),dpi = 200)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(year_group, marker='o', linestyle='dashed')
2.增强图片清晰度
## 输出高清图像
%config InlineBackend.figure_format = 'retina'
%matplotlib inline