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

Skip to content

Discourage omitting backend in matplotlibrc #8518

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

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions doc/users/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ locations, in the following order:
your customizations to be saved, please move this file to your
user-specific matplotlib directory.

Once a :file:`matplotlibrc` file has been found, it will *not* search any of
the other paths.

To display where the currently active :file:`matplotlibrc` file was
loaded from, one can do the following::

Expand All @@ -164,6 +167,12 @@ loaded from, one can do the following::
'/home/foo/.config/matplotlib/matplotlibrc'

See below for a sample :ref:`matplotlibrc file<matplotlibrc-sample>`.
Although all parameters are optional, you should almost always set the
`backend` or else matplotlib will choose `Agg`, a *non-interactive* backend.
This can lead to unexpected behavior, since if you do not have a
:file:`matplotlibrc` file, it would normally fall back to
:file:`{INSTALL}/matplotlib/mpl-data/matplotlibrc`, which is often set to an
interactive backend by the package maintainer.

.. _matplotlibrc-sample:

Expand Down
3 changes: 3 additions & 0 deletions matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
# You can also deploy your own backend outside of matplotlib by
# referring to the module name (which must be in the PYTHONPATH) as
# 'module://my_backend'.
#
# If you omit this parameter, it will always default to "Agg", which is a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this is not quite true, the value of $TEMPLATE_BACKEND is set at build time based on what it finds. Some of the wheels we have released do in fact default to Agg (because they are built in very clean environments).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is what I observed on my particular installation:

  • No user config file: Qt5Agg (the same backend listed in data/matplotlibrc.
  • With user config file but backend is not set in that file: Agg. Naively I would have expected Qt5Agg too but it seems that is not the case. This is what prompted this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yes, you are right 🐑

# non-interactive backend.
backend : $TEMPLATE_BACKEND

# If you are using the Qt4Agg backend, you can choose here
Expand Down