<p dir="auto">Both <code class="notranslate">DataFrame.hist</code> and <code class="notranslate">DataFrame.boxplot</code> support <code class="notranslate">by</code> to create grouped plots, however, <code class="notranslate">DataFrame.hist</code> requires that any column in <code class="notranslate">by</code> is also included in <code class="notranslate">column</code> while <code class="notranslate">DataFrame.boxplot</code> its vice-versa.</p>
<p dir="auto">Here is a minimal example::</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; df = pd.DataFrame({'a': [1, 1, 2, 2, 2, 1], 'b': list('AAABBB')})
&gt;&gt;&gt; df.hist(column=['a', 'b'], by=['b'])
&gt;&gt;&gt; df.boxplot(column=['a'], by=['b'])

&gt;&gt;&gt; df.hist(column=['a'], by=['b'])  # raises an error
KeyError: u'no item named b'"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; df = pd.DataFrame({'a': [1, 1, 2, 2, 2, 1], 'b': list('AAABBB')})
&gt;&gt;&gt; df.hist(column=['a', 'b'], by=['b'])
&gt;&gt;&gt; df.boxplot(column=['a'], by=['b'])

&gt;&gt;&gt; df.hist(column=['a'], by=['b'])  # raises an error
KeyError: u'no item named b'
</code></pre></div>
<p dir="auto">from <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/lodagro/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/lodagro">@lodagro</a>:</p>
<p dir="auto">Been thinking a bit on uniformering signatures for plot, hist, boxplot and what they do/return.<br>
For reference, below an overview what pandas and matplotlib.pyplot have.</p>
<p dir="auto">some things that come to mind</p>
<ul class="contains-task-list">
<li>+1 for what you did with boxplot, <em>by</em> and <em>column</em> are handy, this could also be used for other kind of plots.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> bar-plot goes through plot, why not bar() itself.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> maybe pie() to?</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> plot offers possibility to control <em>sharex</em> and <em>sharey</em>, others don not have this control.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> not all functions use the same subplot layout approach. DataFrame.plot() can plot all lines on a single axis or a nx1 layout. DataFrame.hist() uses nxn layout and DataFrame.boxplot is clever and can do nxm, but the user has no control. Maybe add <em>nrow</em>, <em>ncol</em> arguments? Default to None, meaning pandas can control layout, if either one defined pandas should compute the other one. Can get tricky for plot(), need to do something with <em>subplots</em> argument</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> usage of **<em>kwds</em>, e.g boxplot has it, does not use this. maybe add <em>subplot_kw</em> and <em>figure_kw</em> arguments for dispatching argmuments -- like matplotlib does.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Series.plot has <em>style</em>, DataFrame.plot not -- later could maybe use style/colum (like <em>formatters</em> in to_string)?</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> rot not used everywhere</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> probably many users of pandas are familiar with matplotlib too, in general align plotting signatures and return objects with matplotlib would be a good thing to do?</li>
</ul>
<p dir="auto">Maybe if i stare at it a bit longer i may have some more ideas, but this is getting long already. What do you think?</p>
<h1 dir="auto">for reference</h1>
<h2 dir="auto">Series:</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="plot(self, label=None, kind='line', use_index=True, rot=30, ax=None, style='-',
     grid=True, **kwds)

hist(self, ax=None, grid=True, **kwds)"><pre class="notranslate"><code class="notranslate">plot(self, label=None, kind='line', use_index=True, rot=30, ax=None, style='-',
     grid=True, **kwds)

hist(self, ax=None, grid=True, **kwds)
</code></pre></div>
<h2 dir="auto">DataFrame:</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="boxplot(self, column=None, by=None, ax=None, fontsize=None,
            rot=0, grid=True, **kwds)

plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
         figsize=None, grid=True, legend=True, rot=30, ax=None,
         kind='line', **kwds)

def hist(self, grid=True, **kwds):"><pre class="notranslate"><code class="notranslate">boxplot(self, column=None, by=None, ax=None, fontsize=None,
            rot=0, grid=True, **kwds)

plot(self, subplots=False, sharex=True, sharey=False, use_index=True,
         figsize=None, grid=True, legend=True, rot=30, ax=None,
         kind='line', **kwds)

def hist(self, grid=True, **kwds):
</code></pre></div>
<h2 dir="auto">matplotlib.pyplot</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None,
             frameon=True, FigureClass=&lt;class 'matplotlib.figure.Figure'&gt;,
             **kwargs)

fig, ax = subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
                   subplot_kw=None, **fig_kw)
---&gt; always creates a new figure

plot(*args, **kwargs)
    returns list of matplotlib.lines.Line2D

boxplot(x, notch=0, sym='b+', vert=1, whis=1.5, positions=None,
            widths=None, patch_artist=False, bootstrap=None, hold=None)
    Returns a dictionary, mapping each component of the boxplot
    to a list of the :class:`matplotlib.lines.Line2D`
    instances created.

plt.pie(x, explode=None, labels=None, colors=None, autopct=None,
        pctdistance=0.6, shadow=False, labeldistance=1.1, hold=None)
   Return value:
      If *autopct* is None, return the tuple (*patches*, *texts*):

        - *patches* is a sequence of
          :class:`matplotlib.patches.Wedge` instances

        - *texts* is a list of the label
          :class:`matplotlib.text.Text` instances.

      If *autopct* is *None*, return the tuple (*patches*, *texts*)
      If *autopct* is not *None*, return the tuple (*patches*, *texts*, *autotexts*)

plt.bar(left, height, width=0.8, bottom=None, hold=None, **kwargs)
    Return value is a list of matplotlib.patches.Rectangle instances"><pre class="notranslate"><code class="notranslate">figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None,
             frameon=True, FigureClass=&lt;class 'matplotlib.figure.Figure'&gt;,
             **kwargs)

fig, ax = subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
                   subplot_kw=None, **fig_kw)
---&gt; always creates a new figure

plot(*args, **kwargs)
    returns list of matplotlib.lines.Line2D

boxplot(x, notch=0, sym='b+', vert=1, whis=1.5, positions=None,
            widths=None, patch_artist=False, bootstrap=None, hold=None)
    Returns a dictionary, mapping each component of the boxplot
    to a list of the :class:`matplotlib.lines.Line2D`
    instances created.

plt.pie(x, explode=None, labels=None, colors=None, autopct=None,
        pctdistance=0.6, shadow=False, labeldistance=1.1, hold=None)
   Return value:
      If *autopct* is None, return the tuple (*patches*, *texts*):

        - *patches* is a sequence of
          :class:`matplotlib.patches.Wedge` instances

        - *texts* is a list of the label
          :class:`matplotlib.text.Text` instances.

      If *autopct* is *None*, return the tuple (*patches*, *texts*)
      If *autopct* is not *None*, return the tuple (*patches*, *texts*, *autotexts*)

plt.bar(left, height, width=0.8, bottom=None, hold=None, **kwargs)
    Return value is a list of matplotlib.patches.Rectangle instances
</code></pre></div>