I have the following code:
from matplotlib import pyplot as plt
a = [-2,4,-6,8,9,-5,3,4,-6,7,8,9,4]
b = [3,6,8,6,5,3,-1]
plt.figure()
plt.hist(a)
plt.figure()
plt.hist(b)
which gives me two histograms. Histogram a has larger x and y scales than b. I would like extract these scales and reuse them for b. If I do it per hand it looks like this:
plt.xlim(-6,10)
plt.ylim(0,4)
plt.hist(b)
plt.show()
But I think there must be an automatic way to do it, something like:
ax_scale = plt.get_x_scale(a)
ay_scale = plt.get_y_scale(a)
plt.figure()
plt.set_x_scale(ax_scale)
plt.set_yscale(ay_scale)
plt.hist(b)
I couldn't find such comands, but maybe I was just searching for the wrong words...