Fix Python – Python Matplotlib figure title overlaps axes label when using twiny

I am trying to plot two separate quantities on the same graph using twiny as follows:
fig = figure()
ax = fig.add_subplot(111)
ax.plot(T, r, ‘b-‘, T, R, ‘r-‘, T, r_geo, ‘g-‘)
ax.annotate(‘Approx. sea level’, xy=(Planet.T_day*1.3,(Planet.R)/1000), xytext=(Planet.T_day*1.3, Planet.R/1000))
ax.annotate(‘Geostat. orbit’, xy=(Plane….

Fix Python – How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?

I want to plot data, then create a new figure and plot data2, and finally come back to the original plot and plot data3, kinda like this:
import numpy as np
import matplotlib as plt

x = arange(5)
y = np.exp(5)
plt.plot(x, y)

z = np.sin(x)
plt.plot(x, z)

w = np.cos(x)
plt.figure(“””first figure”””) # Here’s the part I n….

Fix Python – Matplotlib (pyplot) savefig outputs blank image

I am trying to save plots I make using matplotlib; however, the images are saving blank.
Here is my code:

y = copy.deepcopy(tumorStack)
y = == 0, y)

plt.imshow(y,, interpolation=’nearest’)

if T….

Fix Python – Matplotlib different size subplots

I need to add two subplots to a figure. One subplot needs to be about three times as wide as the second (same height). I accomplished this using GridSpec and the colspan argument but I would like to do this using figure so I can save to PDF. I can adjust the first figure using the figsize argument in the constructor, but how do I change the size o….

Fix Python – In Matplotlib, what does the argument mean in fig.add_subplot(111)?

Sometimes I come across code such as this:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
fig = plt.figure()
plt.scatter(x, y)

Which produces:

I’ve been reading the documentation like crazy but I can’t find an explanation for the 111. sometimes I see a 212.
What does the argument of fig…..