Demetri Pananos
Demetri Pananos

Reputation: 7404

How can I make a subplot in a subplot?

I'm looking to make a 2 by 1 subplot, where the second subplot is a 1 by 2 subplot. That would make a total of three subplots stacked like a pyramid.

How can I achieve this?

Upvotes: 0

Views: 51

Answers (1)

Ilya V. Schurov
Ilya V. Schurov

Reputation: 8047

I'm not sure that this is exactly what you need but I believe GridSpec can be useful here. For example (from that page):

ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3)
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
ax4 = plt.subplot2grid((3, 3), (2, 0))
ax5 = plt.subplot2grid((3, 3), (2, 1))

Provide the following layout:

layout

Upvotes: 1

Related Questions