pandas histogram with by: possible to make axes uniform?
<p>I am using the option to generate a separate histogram of a value for each group in a data frame like so (example code from documentation)</p>

<pre><code>data = pd.Series(np.random.randn(1000))
data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4))
</code></pre>

<p>This is great, but what I am not seeing is a way to set and standardize the axes. Is this possible?</p>

<p>To be specific, I would like to specify the x and y axes of the plots so that the y axis in particular has the same range for all plots. Otherwise it can be hard to compare distributions to one another.</p>

<p>you can pass <code>kwds</code> to hist and it will pass them along to appropriate sub processes.  The relevant ones here are <code>sharex</code> and <code>sharey</code></p>

<pre><code>data = pd.Series(np.random.randn(1000))
data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4),
          sharex=True, sharey=True)
</code></pre>

<p><a href="http://i.stack.imgur.com/q86d4.png" rel="nofollow"><img src="http://i.stack.imgur.com/q86d4.png" alt="enter image description here"></a></p>

python pandas