I would use imshow for this, so I will use it to describe my problem.
I have several matrices which I would like to plot on the same axis. Something like this:
import matplotlib.pyplot as plt
import numpy as np
a = np.array([[0,1,2],[0,1,2]])
x = np.array([0,1,2])
y = np.array([0,1])
a2 = np.array([[10,11,12],[10,11,12]])
x2 = np.array([10,11,12])
y2 = np.array([0,1])
plt.imshow(a,extent=[x.min(),x.max(),y.min(),y.max()])
plt.imshow(a2,extent=[x2.min(),x2.max(),y2.min(),y2.max()])
plt.show()
(With this code the first imshow is overwritten by the second)
The reason why I can’t combine them into a single matrix with one set of x and y axes (by filling the gaps with zeros) is that the combined matrix would be huge and there are large spaces in between the strips.
It’s not overwritten, the axes limits are just reset to the extents of the last image each time.
Just call
plt.autoscale().As a quick example of what you’re seeing:
Now, if we just call
autoscale: