Reputation: 103
my interrogation is the following :
I have a code that generates a plot using :
fig = plt.figure( figsize=(6.5,10))
ax = fig.gca()
I've used this routine to generate multiple plots. Is there a simple way to make the plot look like :
I know there is a command plt.subplots but I dont know how to place each plots in this configuration. Any help would be greatly appreciated
Upvotes: 0
Views: 43
Reputation: 78
gridspec
is your friend here:
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
fig = plt.figure(figsize=(18,8))
gs = gridspec.GridSpec(1, 5)
ax1 = fig.add_subplot(gs[0])
ax2 = fig.add_subplot(gs[1])
ax3 = fig.add_subplot(gs[2])
ax4 = fig.add_subplot(gs[3])
ax5 = fig.add_subplot(gs[4])
plt.subplots_adjust(wspace=0)
ax2.set_yticks([])
ax3.set_yticks([])
ax4.set_yticks([])
ax5.set_yticks([])
Upvotes: 1