Skip to content

Rewrite of the entire legend documentation, including tidy ups of code and style to all things "legend". #2442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rewrite of the entire legend documentation, including tidy ups of code
and style to all things "legend".
  • Loading branch information
pelson committed Jan 28, 2014
commit 99f325dcd3f045f92c422d335e3d5be4a72b33f6
10 changes: 10 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ original location:
thus `colorbar.ColorbarBase.outline` is now a
`matplotlib.patches.Polygon` object.

* The legend handler interface has changed from a callable, to any object
which implements the ``legend_artists`` method. See
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is backward-incompatible change and I do not see any obvious reason for the change. Can you explain your motivation behind this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It improves readability of the underlying code (it is easier to see method names than parentheses).

It is feasible to go through a stage of deprecation with callable objects if that would make life easier, but I suspect there are very few people other than yourself who has implemented a custom handler, so I personally I think the backwards incompatibility vs the readability benefit is worthwhile here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I would say this is a "usability vs. readability". I would prefer to use a simple function (as a handler) for simple tasks.

Anyhow, this is not a showstopper and I think you can go ahead and merge it.

:ref:`plotting-guide-legend` for further details. Further legend changes
include:

* :func:`matplotlib.axes.Axes._get_legend_handles` now returns a generator
of handles, rather than a list.

* The :func:`~matplotlib.pyplot.legend` function's "loc" positional
argument has been deprecated. Use the "loc" keyword instead.

* The rcParams `savefig.transparent` has been added to control
default transparency when saving figures.
Expand Down
1 change: 0 additions & 1 deletion doc/api/axes_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ axes
.. autoclass:: matplotlib.axes.Axes
:members:
:undoc-members:

8 changes: 7 additions & 1 deletion doc/api/legend_api.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
******
legend
Legend
******


Expand All @@ -10,3 +10,9 @@ legend
:members:
:undoc-members:
:show-inheritance:

:mod:`matplotlib.legend_handler`
================================
.. automodule:: matplotlib.legend_handler
:members:
:undoc-members:
4 changes: 2 additions & 2 deletions doc/api/matplotlib_configuration_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ The top level :mod:`matplotlib` module

.. autofunction:: use

.. autofunction:: get_backend
.. autofunction:: get_backend

.. py:data:: matplotlib.rcParams
.. py:data:: rcParams

An instance of :class:`RcParams` for handling default matplotlib values.

Expand Down
12 changes: 12 additions & 0 deletions doc/api/offsetbox.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*********
offsetbox
*********


:mod:`matplotlib.offsetbox`
===========================

.. automodule:: matplotlib.offsetbox
:members:
:undoc-members:
:show-inheritance:
Loading