-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
allow selecting the backend by setting the environment variable MPLBACKEND #3710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0d995d4
0ead4b2
fffa9c1
7290dc1
0042453
40e4019
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Made how to set backend an ordered list
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,37 +302,41 @@ pygtk, wxpython, tkinter, qt4, or macosx; also referred to as | |
"interactive backends") and hardcopy backends to make image files | ||
(PNG, SVG, PDF, PS; also referred to as "non-interactive backends"). | ||
|
||
There are a four ways to configure your backend. One is to set | ||
the ``backend`` parameter in your ``matplotlibrc`` file (see | ||
:ref:`customizing-matplotlib`):: | ||
There are a four ways to configure your backend, in reversed order | ||
of precedence: | ||
|
||
backend : WXAgg # use wxpython with antigrain (agg) rendering | ||
#. The ``backend`` parameter in your ``matplotlibrc`` file (see | ||
:ref:`customizing-matplotlib`):: | ||
|
||
Another way to do this is setting the :envvar:`MPLBACKEND` environment | ||
variable, either globally or for a single script:: | ||
backend : WXAgg # use wxpython with antigrain (agg) rendering | ||
|
||
> export MPLBACKEND="module://my_backend" | ||
> python simple_plot.py | ||
#. Setting the :envvar:`MPLBACKEND` environment | ||
variable, either globally or for a single script:: | ||
|
||
To set the backend for a single script, you can alternatively use the `-d` | ||
command line argument:: | ||
> export MPLBACKEND="module://my_backend" | ||
> python simple_plot.py | ||
|
||
> python script.py -dbackend | ||
#. To set the backend for a single script, you can alternatively use the `-d` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am ambivalent about advertising this feature. I do see the warning below, but I'd much rather go the route of deprecating this feature in favor of the environment variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah -- maybe we should start the deprecation process for this now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like the idea of completely leaving
Should using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please On Tue, Nov 18, 2014 at 11:29 AM, Florian Rhiem notifications@github.com
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should probably raise a mplDeprecation warning. Like #3812 |
||
command line argument:: | ||
|
||
You should be aware though that this might conflict with scripts which use the | ||
command line arguments. | ||
> python script.py -dbackend | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space |
||
|
||
If your script depends on a specific backend you can use the matplotlib | ||
:func:`~matplotlib.use` directive:: | ||
This might conflict with scripts which parse | ||
command line arguments (see issue | ||
`#1986 <https://github.com/matplotlib/matplotlib/issues/1986>`_). | ||
|
||
import matplotlib | ||
matplotlib.use('PS') # generate postscript output by default | ||
#. If your script depends on a specific backend you can use the | ||
:func:`~matplotlib.use` function:: | ||
|
||
If you use the ``use`` directive, this must be done before importing | ||
:mod:`matplotlib.pyplot` or :mod:`matplotlib.pylab`. Using this function will | ||
require a change in your code for users who would like to use a different | ||
backend. Therefore you should avoid explicitly calling ``use`` unless | ||
necessary. | ||
import matplotlib | ||
matplotlib.use('PS') # generate postscript output by default | ||
|
||
If you use the ``use``, this must be done before importing | ||
:mod:`matplotlib.pyplot`, calling :func:`~matplotlib.use` after pyplot | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comma to period, and "calling" --> "Calling" |
||
has been imported will have no effect. Using `use` will | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. double backticks? or should it be single backticks earlier in this paragraph? |
||
require changes in your code if users want to use a different | ||
backend. Therefore, you should avoid explicitly calling ``use`` unless | ||
absolutely necessary. | ||
|
||
.. note:: | ||
Backend name specifications are not case-sensitive; e.g., 'GTKAgg' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"reversed order of precedence" when I think of "reversed order", I am usually thinking of things decreasing. This could be reworded better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WeatherGod How about this: