I just want to plot several data sets, say 4, using subfigures, i.e. something like
fig = figure(1)
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
This is working well. But additionally I´d like to set different background colours for the two subplots in the first row and the ones in the second row such that the upper half of the figure´s background is black and the lower half white. Can anybody tell me how to do this?
Well, what I tried so far was to define two figures, one with a black and another one with a white background adding the first two subfigures to figure 1 and the other ones to figure 2. In the end I merged both figures into a PDF but the results was not satisfying since the PDF file was a mess and the two figures were actually looking like two distinct ones but not like a single figure.
Additionally I tried something like
fig = figure(1)
rect = fig.patch
rect.set_facecolor('black')
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
rect = fig.patch
rect.set_facecolor('white')
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
but apparently it cannot work like this. Then I tried to create a rectangle as background for each subfigure using matplotlib.patches which seems to be inappropriate as well.