You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/visualization.rst
+10-14
Original file line number
Diff line number
Diff line change
@@ -456,25 +456,21 @@ columns:
456
456
457
457
.. _visualization.box.return:
458
458
459
-
Basically, plot functions return :class:`matplotlib Axes <matplotlib.axes.Axes>` as a return value.
460
-
In ``boxplot``, the return type can be changed by argument ``return_type``, and whether the subplots is enabled (``subplots=True`` in ``plot`` or ``by`` is specified in ``boxplot``).
459
+
.. warning::
461
460
462
-
When ``subplots=False`` / ``by`` is ``None``:
461
+
The default changed from ``'dict'`` to ``'axes'`` in version 0.18.0.
463
462
464
-
* if ``return_type`` is ``'dict'``, a dictionary containing the :class:`matplotlib Lines <matplotlib.lines.Line2D>` is returned. The keys are "boxes", "caps", "fliers", "medians", and "whiskers".
465
-
This is the default of ``boxplot`` in historical reason.
466
-
Note that ``plot.box()`` returns ``Axes`` by default same as other plots.
467
-
* if ``return_type`` is ``'axes'``, a :class:`matplotlib Axes <matplotlib.axes.Axes>` containing the boxplot is returned.
468
-
* if ``return_type`` is ``'both'`` a namedtuple containing the :class:`matplotlib Axes <matplotlib.axes.Axes>`
469
-
and :class:`matplotlib Lines <matplotlib.lines.Line2D>` is returned
463
+
Plot functions return scalar or arrays of :class:`matplotlib Axes <matplotlib.axes.Axes>`.
464
+
In ``boxplot``, the return type can be controlled by the ``return_type``, keyword. The valid choices are ``{"axes", "dict", "both"}``. If the ``by`` argument is ``None``,
470
465
471
-
When ``subplots=True`` / ``by`` is some column of the DataFrame:
466
+
* ``'axes'`` returns a single matplotlib axes.
467
+
* ``'dict'`` returns a dict of matplotlib artists, similar to the matplotlib boxplot function.
468
+
* ``'both'`` returns a named tuple of axes and dicts.
472
469
473
-
* A dict of ``return_type`` is returned, where the keys are the columns
474
-
of the DataFrame. The plot has a facet for each column of
475
-
the DataFrame, with a separate box for each value of ``by``.
470
+
When ``by`` is not None, you get back an ``OrderedDict`` of whatever ``return_type`` is.
471
+
Unless ``return_type`` is just ``None``, in which case you get back an array of axes.
476
472
477
-
Finally, when calling boxplot on a :class:`Groupby` object, a dict of ``return_type``
473
+
Finally, when calling boxplot on a :class:`Groupby` object, an ``OrderedDict`` of ``return_type``
478
474
is returned, where the keys are the same as the Groupby object. The plot has a
479
475
facet for each key, with each facet containing a box for each column of the
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.18.0.txt
+1
Original file line number
Diff line number
Diff line change
@@ -1168,6 +1168,7 @@ Removal of prior version deprecations/changes
1168
1168
- Removal of ``rolling_corr_pairwise`` in favor of ``.rolling().corr(pairwise=True)`` (:issue:`4950`)
1169
1169
- Removal of ``expanding_corr_pairwise`` in favor of ``.expanding().corr(pairwise=True)`` (:issue:`4950`)
1170
1170
- Removal of ``DataMatrix`` module. This was not imported into the pandas namespace in any event (:issue:`12111`)
1171
+
- Changed the default value for the ``return_type`` parameter for ``DataFrame.plot.box`` and ``DataFrame.boxplot`` from ``None`` to ``"axes"``. These methods will now return a matplotlib axes by default instead of a dictionary of artists. See :ref:`here <visualization.box.return>` (:issue:`6581`).
1171
1172
- Removal of ``cols`` keyword in favor of ``subset`` in ``DataFrame.duplicated()`` and ``DataFrame.drop_duplicates()`` (:issue:`6680`)
1172
1173
- Removal of the ``read_frame`` and ``frame_query`` (both aliases for ``pd.read_sql``)
1173
1174
and ``write_frame`` (alias of ``to_sql``) functions in the ``pd.io.sql`` namespace,
0 commit comments