# 导入datetime模块三个核心的类
from datetime import datetime # class one:datetime 日期时间
from datetime import date # class two:date 日期
from datetime import time # class three:time 时间
#读取数据
file_path = "bee.csv"
df = pd.read_csv(file_path)
df.index = pd.to_datetime(df.time)
import matplotlib.pyplot as plt
#绘制天数的散点图
plot_true= plt.plot(df.time, df.bee_io, 'o', label= 'bee_io')
plt.xlabel('time')
plt.xticks(rotation=45)#旋转x轴标签
plt.ylabel('bee_io')
plt.legend(loc=4)
#plt.title('plot date test')
plt.style.use({'figure.figsize':(35,15)})#设置图大小
from matplotlib.pyplot import MultipleLocator#设置坐标轴刻度间
#可以设置坐标轴间隔
x_major_locator= MultipleLocator(50)#把x轴的刻度间隔设置为15,并存在变量里
y_major_locator= MultipleLocator(5)#把y轴的刻度间隔设置为5,并存在变量里
ax= plt.gca()#ax为两条坐标轴的实例
ax.xaxis.set_major_locator(x_major_locator)#把x轴的主刻度设置为1的倍数
ax.yaxis.set_major_locator(y_major_locator)#把y轴的主刻度设置为5的倍数
plt.show()