FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Deprecate frameon kwarg and rcParam to savefig. by anntzer · Pull Request #11692 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .mplstyle  (2) .py  (2) .rst  (1) .template  (1) All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/2018-09-25-AL.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Deprecations
````````````

The ``frameon`` kwarg to ``savefig`` and the ``savefig.frameon`` rcParam
are deprecated. To emulate ``frameon = False``, set ``facecolor`` to fully
transparent (``"none"``, or ``(0, 0, 0, 0)``).
1 change: 1 addition & 0 deletions lib/matplotlib/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ def gen_candidates():
# Values are tuples of (version,)
_deprecated_remain_as_none = {
'text.latex.unicode': ('3.0',),
'savefig.frameon': ('3.1',),
}


Expand Down
17 changes: 9 additions & 8 deletions lib/matplotlib/figure.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ def add_axobserver(self, func):
"""Whenever the axes state change, ``func(self)`` will be called."""
self._axobservers.append(func)

def savefig(self, fname, *, frameon=None, transparent=None, **kwargs):
def savefig(self, fname, *, transparent=None, **kwargs):
"""
Save the current figure.

Expand Down Expand Up @@ -2102,11 +2102,6 @@ def savefig(self, fname, *, frameon=None, transparent=None, **kwargs):
transparency of these patches will be restored to their
original values upon exit of this function.

frameon : bool
If *True*, the figure patch will be colored, if *False*, the
figure background will be transparent. If not provided, the
rcParam 'savefig.frameon' will be used.

bbox_inches : str or `~matplotlib.transforms.Bbox`, optional
Bbox in inches. Only the given portion of the figure is
saved. If 'tight', try to figure out the tight bbox of
Expand Down Expand Up @@ -2138,8 +2133,14 @@ def savefig(self, fname, *, frameon=None, transparent=None, **kwargs):
"""

kwargs.setdefault('dpi', rcParams['savefig.dpi'])
if frameon is None:
frameon = rcParams['savefig.frameon']
if "frameon" in kwargs:
cbook.warn_deprecated("3.1", name="frameon", obj_type="kwarg",
alternative="facecolor")
frameon = kwargs.pop("frameon")
if frameon is None:
frameon = dict.__getitem__(rcParams, 'savefig.frameon')
else:
frameon = False # Won't pass "if frameon:" below.
if transparent is None:
transparent = rcParams['savefig.transparent']

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ savefig.pad_inches : 0.1 # Padding to be used when bbox is set to 'tight'
savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
savefig.transparent : False # setting that controls whether figures are saved with a
# transparent background by default
savefig.frameon : True
savefig.orientation : portrait

# ps backend params
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ savefig.pad_inches : 0.1 # Padding to be used when bbox is set to 'tight'
savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
savefig.transparent : False # setting that controls whether figures are saved with a
# transparent background by default
savefig.frameon : True
savefig.orientation : portrait

# ps backend params
Expand Down
1 change: 0 additions & 1 deletion matplotlibrc.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@
## leave empty to always use current working directory
#savefig.transparent : False ## setting that controls whether figures are saved with a
## transparent background by default
#savefig.frameon : True ## enable frame of figure when saving
#savefig.orientation : portrait ## Orientation of saved figure

### tk backend params
Expand Down

Back | FazBrowse Home | New Git URL