Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0042453

Browse files
committed
Added a warning about global use of MPLBACKEND or use of -dbackend
1 parent 7290dc1 commit 0042453

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

doc/faq/usage_faq.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,19 +311,28 @@ of precedence:
311311
backend : WXAgg # use wxpython with antigrain (agg) rendering
312312

313313
#. Setting the :envvar:`MPLBACKEND` environment
314-
variable, either globally or for a single script::
314+
variable, either for your current shell or for a single script::
315315

316316
> export MPLBACKEND="module://my_backend"
317317
> python simple_plot.py
318318

319+
> MPLBACKEND="module://my_backend" python simple_plot.py
320+
321+
Setting this environment variable will override the ``backend`` parameter
322+
in *any* ``matplotlibrc``, even if there is a ``matplotlibrc`` in your
323+
current working directory. Therefore setting :envvar:`MPLBACKEND`
324+
globally, e.g. in your ``.bashrc`` or ``.profile``, is discouraged as it
325+
might lead to counter-intuitive behavior.
326+
319327
#. To set the backend for a single script, you can alternatively use the `-d`
320328
command line argument::
321329

322330
> python script.py -dbackend
323331

324332
This might conflict with scripts which parse
325333
command line arguments (see issue
326-
`#1986 <https://github.com/matplotlib/matplotlib/issues/1986>`_).
334+
`#1986 <https://github.com/matplotlib/matplotlib/issues/1986>`_), so you
335+
should use :envvar:`MPLBACKEND` instead.
327336

328337
#. If your script depends on a specific backend you can use the
329338
:func:`~matplotlib.use` function::

0 commit comments

Comments
 (0)