8000 Documentation for the autoscale contextmanager. · matplotlib/matplotlib@90397f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90397f9

Browse files
committed
Documentation for the autoscale contextmanager.
1 parent 4f30cce commit 90397f9

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

doc/api/api_changes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ sources of the changes you are experiencing.
1111
For new features that were added to matplotlib, please see
1212
:ref:`whats-new`.
1313

14+
Changes in 2.1.0
15+
================
16+
17+
Code changes
18+
------------
19+
20+
autoscale is now a context manager
21+
``````````````````````````````````
22+
23+
Instead of returning None, ``plt.autoscale`` and ``Axes.autoscale``
24+
now return a context manager, which allows one to restore the previous
25+
autoscaling status upon exiting the block.
26+
1427
Changes in 2.0.0
1528
================
1629

doc/users/whats_new.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ revision, see the :ref:`github-stats`.
2323
.. contents:: Table of Contents
2424
:depth: 3
2525

26+
.. _whats-new-2-1:
27+
28+
new in matplotlib-2.1
29+
=====================
30+
31+
autoscale is now a context manager
32+
----------------------------------
33+
34+
Instead of returning None, ``plt.autoscale`` and ``Axes.autoscale``
35+
now return a context manager, which allows one to restore the previous
36+
autoscaling status upon exiting the block.
37+
2638
.. _whats-new-1-5:
2739

2840
new in matplotlib-1.5

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,13 +2109,8 @@ def autoscale(self, enable=True, axis='both', tight=None):
21092109
21102110
with axes.autoscale(enable): ...
21112111
2112-
or::
2113-
2114-
@axes.autoscale(enable)
2115-
def func(): ...
2116-
21172112
will keep the autoscale status to `enable` for the duration of the
2118-
block or function and then restore it to its original value.
2113+
block only.
21192114
"""
21202115
orig_autoscale = self._autoscaleXon, self._autoscaleYon
21212116
if enable is not None:

0 commit comments

Comments
 (0)
0