zxy0307's picture
Upload 141 files
593040d verified
raw
history blame contribute delete
864 Bytes
import pandas as pd
import matplotlib.pyplot as plt
"""
设置画布
语法格式:
matpoltlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True)
参数说明:
num: 图像编号或名称,数字为编号,字符串为名称,可以通过该参数激活不同的画布
figsize: 指定画布的宽和高,单位为英寸
dpi: 指定绘图对象的分辨率,即每英寸包含多少个像素,默认值为80.像素越大,画布越大
facecolor: 背景颜色
edgeolor: 边框颜色
frameon: 是否显示边框,默认值为True,绘制边框,如果为False,则不绘制边框
"""
df = pd.read_excel('libs/未来15天天气预报.xlsx')
# 设置画布颜色和大小
plt.figure(facecolor='yellow', figsize=(10, 6))
x = df['日期']
y = df['温度']
plt.plot(x, y)
plt.show()