-
折线图
import matplotlib.pyplot as plt #可视化库
import pandas as pd #数据清洗库
import numpy as np #科学计算库
plt.rcParams['font.sans-serif'] = ['simhei'] # 设置字体,中文不是乱码
plt.rcParams['axes.unicode_minus'] = False
plt.figure() # figure创造画布 fig
x = ['北京','上海','深圳']
y = np.array([1,2,3])
plt.plot(x,y,color='b',linestyle='-.',marker='o') # 设置线型,颜色和标记形状
plt.plot(x,y + 2,color='k',linestyle=':',marker='v')
plt.plot(x,y + 1,color='red',linestyle='--',marker='d')
饼图
plt.pie(
x=[1, 2, 3], #指定绘图数据
labels=['A', 'B', 'C'], #为