print(plt.style.available) # 打印样式列表
['bmh', 'classic', 'dark_background', 'fast',
'fivethirtyeight', 'ggplot', 'grayscale', 'seaborn-bright',
'seaborn-colorblind', 'seaborn-dark-palette', 'seaborn-dark', 'seaborn-darkgrid',
'seaborn-deep', 'seaborn-muted', 'seaborn-notebook', 'seaborn-paper',
'seaborn-pastel', 'seaborn-poster', 'seaborn-talk', 'seaborn-ticks',
'seaborn-white', 'seaborn-whitegrid', 'seaborn', 'Solarize_Light2',
'tableau-colorblind10', '_classic_test']
plt.style.use('bmh')
plt.style.use('bmh')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
bmh
plt.style.use('classic')
plt.style.use('classic')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
classic
plt.style.use('dark_background')
plt.style.use('dark_background')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
dark_background
plt.style.use('fast')
plt.style.use('fast')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
fast
plt.style.use('fivethirtyeight')
plt.style.use('fivethirtyeight')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
fivethirtyeight
plt.style.use('ggplot')
plt.style.use('ggplot')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
ggplot
plt.style.use('grayscale')
plt.style.use('grayscale')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
grayscale
plt.style.use('seaborn-bright')
plt.style.use('seaborn-bright')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-bright
plt.style.use('seaborn-colorblind')
plt.style.use('seaborn-colorblind')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-colorblind
plt.style.use('seaborn-dark-palette')
plt.style.use('seaborn-dark-palette')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-dark-palette
plt.style.use('seaborn-dark')
plt.style.use('seaborn-dark')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-dark
plt.style.use('seaborn-darkgrid')
plt.style.use('seaborn-darkgrid')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-darkgrid
plt.style.use('seaborn-deep')
plt.style.use('seaborn-deep')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-deep
plt.style.use('seaborn-muted')
plt.style.use('seaborn-muted')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-muted
plt.style.use('seaborn-notebook')
plt.style.use('seaborn-notebook')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-notebook
plt.style.use('seaborn-paper')
plt.style.use('seaborn-paper')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-paper
plt.style.use('seaborn-pastel')
plt.style.use('seaborn-pastel')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-pastel
plt.style.use('seaborn-poster')
plt.style.use('seaborn-poster')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-poster
plt.style.use('seaborn-talk')
plt.style.use('seaborn-talk')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-talk
plt.style.use('seaborn-ticks')
plt.style.use('seaborn-ticks')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-ticks
plt.style.use('seaborn-white')
plt.style.use('seaborn-white')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-white
plt.style.use('seaborn-whitegrid')
plt.style.use('seaborn-whitegrid')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn-whitegrid
plt.style.use('seaborn')
plt.style.use('seaborn')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
seaborn
plt.style.use('Solarize_Light2')
plt.style.use('Solarize_Light2')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
Solarize_Light2
plt.style.use('tableau-colorblind10')
plt.style.use('tableau-colorblind10')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
tableau-colorblind10
plt.style.use('_classic_test')
plt.style.use('_classic_test')
# 正常显示中文字体
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 生成一张12*4的图
fig = plt.figure(figsize=(12,4))
# 生成第一个子图在1行2列第一列位置
ax1 = fig.add_subplot(121)
# 生成第二子图在1行2列第二列位置
ax2 = fig.add_subplot(122)
# 柱状图数据
x1 = [0.3, 1.7, 4, 6, 7]
y1 = [5, 20, 15, 25, 10]
# 折线图数据
x2 = np.arange(0,10)
y2 = [25,2,12,30,20,40,50,30,40,15]
# 第一个子图绘图和设置
ax1.bar(x1,y1)
ax1.set(xlabel='横坐标',ylabel='纵坐标',title='我在第一列位置')
# 第二个子图绘图和设置
ax2.plot(x2,y2)
ax2.set(xlabel='横坐标',ylabel='纵坐标',title='我在第二列位置')
plt.show()
_classic_test