大数据分析——matplotlib
参考链接:https://blog.csdn.net/xavier_muse/article/details/83859272
fig,ax = plt.subplots()等价于:
-
fig = plt.figure()
-
ax = fig.add_subplot(1,1,1)
fig, ax = plt.subplots(1,3)
,其中参数1和3分别代表子图的行数和列数,一共有 1x3 个子图像。函数返回一个figure图像和子图ax的array列表。fig, ax = plt.subplots(1,3,1),最后一个参数1代表第一个子图。
如果想要设置子图的宽度和高度可以在函数内加入figsize值
fig, ax = plt.subplots(1,3,figsize=(15,7)),这样就会有1行3个15x7大小的子图。