6. Matplotlib子图绘制

版权声明:转载注明出处 https://blog.csdn.net/deephacking/article/details/82731763
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# 生成一个母图fig,可以设置母图figsize大小
# fig = plt.figure(figsize=(10, 3))
fig = plt.figure()
ax1 = fig.add_subplot(2, 2, 1)
ax2 = fig.add_subplot(2, 2, 2)
ax4 = fig.add_subplot(2, 2, 4)
# 此处设置ax1,2,3,4的属性即可更改图像的参数
ax1.plot(np.random.randint(1, 5, 5), np.arange(5))
ax2.plot(np.arange(10)*3, np.arange(10))

fig.show()

猜你喜欢

转载自blog.csdn.net/deephacking/article/details/82731763