Skip to content
Closed
Changes from all commits
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
13 changes: 5 additions & 8 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import numpy as np

from matplotlib import rcParams
from matplotlib import docstring
from matplotlib import backends, docstring
from matplotlib import __version__ as _mpl_version
from matplotlib import get_backend

Expand Down Expand Up @@ -415,12 +415,8 @@ def show(self, warn=True):
Parameters
----------
warn : bool
If ``True``, issue warning when called on a non-GUI backend

Notes
-----
For non-GUI backends, this does nothing, in which case a warning will
be issued if *warn* is ``True`` (default).
If ``True`` and we are not running headless (i.e. on Linux with an
unset DISPLAY), issue warning when called on a non-GUI backend.
"""
try:
manager = getattr(self.canvas, 'manager')
Expand All @@ -436,7 +432,8 @@ def show(self, warn=True):
return
except NonGuiException:
pass
if warn:
if (backends._get_running_interactive_framework() != "headless"
and warn):
warnings.warn('Matplotlib is currently using %s, which is a '
'non-GUI backend, so cannot show the figure.'
% get_backend())
Expand Down