Skip to content

Commit

Permalink
Documentation for the autoscale contextmanager.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Nov 23, 2015
1 parent 4f30cce commit 90397f9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
13 changes: 13 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ sources of the changes you are experiencing.
For new features that were added to matplotlib, please see
:ref:`whats-new`.

Changes in 2.1.0
================

Code changes
------------

autoscale is now a context manager
``````````````````````````````````

Instead of returning None, ``plt.autoscale`` and ``Axes.autoscale``
now return a context manager, which allows one to restore the previous
autoscaling status upon exiting the block.

Changes in 2.0.0
================

Expand Down
12 changes: 12 additions & 0 deletions doc/users/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ revision, see the :ref:`github-stats`.
.. contents:: Table of Contents
:depth: 3

.. _whats-new-2-1:

new in matplotlib-2.1
=====================

autoscale is now a context manager
----------------------------------

Instead of returning None, ``plt.autoscale`` and ``Axes.autoscale``
now return a context manager, which allows one to restore the previous
autoscaling status upon exiting the block.

.. _whats-new-1-5:

new in matplotlib-1.5
Expand Down
7 changes: 1 addition & 6 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2109,13 +2109,8 @@ def autoscale(self, enable=True, axis='both', tight=None):
with axes.autoscale(enable): ...
or::
@axes.autoscale(enable)
def func(): ...
will keep the autoscale status to `enable` for the duration of the
block or function and then restore it to its original value.
block only.
"""
orig_autoscale = self._autoscaleXon, self._autoscaleYon
if enable is not None:
Expand Down

0 comments on commit 90397f9

Please sign in to comment.