I want to add a line with plot()
to a color map made with imshow()
in matplotlib,
where several sub-figures of different sizes are assumed. When adding a line,
the color map somehow changes size. How do I get around this?
Here is a simple example illustrating the problem:
import scipy.stats as stat
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
fig = plt.figure(figsize=(12, 4))
plt.axes([.05,.1,.4,.8])
data = stat.uniform.rvs(size=2400).reshape((40,60))
plt.imshow(data,cmap=cm.jet,vmin=0,vmax=1)
plt.colorbar(fraction=.03)
plt.plot(range(60),20*np.ones(60),'w-',lw=3) # <-- causing problems
plt.title('the damn white line')