@@ -302,19 +302,37 @@ pygtk, wxpython, tkinter, qt4, or macosx; also referred to as
302302"interactive backends") and hardcopy backends to make image files
303303(PNG, SVG, PDF, PS; also referred to as "non-interactive backends").
304304
305- There are a two primary ways to configure your backend. One is to set
305+ There are a four ways to configure your backend. One is to set
306306the ``backend `` parameter in your ``matplotlibrc `` file (see
307307:ref: `customizing-matplotlib `)::
308308
309309 backend : WXAgg # use wxpython with antigrain (agg) rendering
310310
311- The other is to use the matplotlib :func: `~matplotlib.use ` directive::
311+ Another way to do this is setting the :envvar: `MPLBACKEND ` environment
312+ variable, either globally or for a single script::
313+
314+ > export MPLBACKEND="module://my_backend"
315+ > python simple_plot.py
316+
317+ To set the backend for a single script, you can alternatively use the `-d `
318+ command line argument::
319+
320+ > python script.py -dbackend
321+
322+ You should be aware though that this might conflict with scripts which use the
323+ command line arguments.
324+
325+ If your script depends on a specific backend you can use the matplotlib
326+ :func: `~matplotlib.use ` directive::
312327
313328 import matplotlib
314329 matplotlib.use('PS') # generate postscript output by default
315330
316331If you use the ``use `` directive, this must be done before importing
317- :mod: `matplotlib.pyplot ` or :mod: `matplotlib.pylab `.
332+ :mod: `matplotlib.pyplot ` or :mod: `matplotlib.pylab `. Using this function will
333+ require a change in your code for users who would like to use a different
334+ backend. Therefore you should avoid explicitly calling ``use `` unless
335+ necessary.
318336
319337.. note ::
320338 Backend name specifications are not case-sensitive; e.g., 'GTKAgg'
@@ -325,7 +343,7 @@ binary installer or a linux distribution package, a good default
325343backend will already be set, allowing both interactive work and
326344plotting from scripts, with output to the screen and/or to
327345a file, so at least initially you will not need to use either of the
328- two methods given above.
346+ methods given above.
329347
330348If, however, you want to write graphical user interfaces, or a web
331349application server (:ref: `howto-webapp `), or need a better
0 commit comments