How to make an axes occupy multiple subplots with pyplot (Python)

前端 未结 5 1922
盖世英雄少女心
盖世英雄少女心 2021-01-31 14:32

I would like to have three plots in single figure. The figure should have a subplot layout of two by two, where the first plot should occupy the first two subplot cells (i.e. th

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 15:14

    There are three main options in matplotlib to make separate plots within a figure:

    1. subplot: access the axes array and add subplots
    2. gridspec: control the geometric properties of the underlying figure (demo)
    3. subplots: wraps the first two in a convenient api (demo)

    The posts so far have addressed the first two options, but they have not mentioned the third, which is the more modern approach and is based on the first two options. See the specific docs Combining two subplots using subplots and GridSpec.

提交回复
热议问题