allow selecting the backend by setting the environment variable MPLBACKEND

This commit adds a new way of selecting the matplotlib backend. The `-d` flag can cause problems with scripts that use the command line arguments as parameters and don't ignore unknown ones. An environment variable `MPL_BACKEND` can be set by the user (or in the code) and is far less likely to cause problems than using the `-d` flag.
Yes please

On Tue, Nov 18, 2014 at 11:29 AM, Florian Rhiem <notifications@github.com>
wrote:

> In doc/faq/usage_faq.rst:
>
> >
> > -If you use the ``use`` directive, this must be done before importing
> > -:mod:`matplotlib.pyplot` or :mod:`matplotlib.pylab`.
> > +        > export MPLBACKEND="module://my_backend"
> > +        > python simple_plot.py
> > +
> > +        > MPLBACKEND="module://my_backend" python simple_plot.py
> > +
> > +   Setting this environment variable will override the ``backend`` parameter
> > +   in *any* ``matplotlibrc``, even if there is a ``matplotlibrc`` in your
> > +   current working directory. Therefore setting :envvar:`MPLBACKEND`
> > +   globally, e.g. in your ``.bashrc`` or ``.profile``, is discouraged as it
> > +   might lead to counter-intuitive behavior.
> > +
> > +#. To set the backend for a single script, you can alternatively use the `-d`
>
> I don't like the idea of completely leaving -d out of the documentation
> as long as it is still supported. How about replacing the previous warning
> about issue 1986 <https://github.com/matplotlib/matplotlib/issues/1986>
> with the following:
>
> This method is **deprecated** as the `-d` argument might conflict with
> scripts which parse command line arguments (see issue
> `#1986 <https://github.com/matplotlib/matplotlib/issues/1986>`_). You
> should use :envvar:`MPLBACKEND` instead.
>
> Should using the -d flag also cause a runtime warning?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/matplotlib/matplotlib/pull/3710/files#r20517466>.
>