Description
Problem
It seems that simply importing pyplot can have serious effects on what backends are chosen, and how they interact with one and other.
In
matplotlib/lib/matplotlib/__init__.py
Line 1137 in da9533d
They say that simply
from matplotlib import pyplot
can trigger setting the default backend.
This is somewhat frustrating for people who use interactive sessions.
Running the code
from matplotlib import pyplot
import matplotlib
matplotlib.use("WxAgg")
all at once will work in ipython (from the terminal). But running it one line at a time, won't.
This is somewhat strange.
Now that things like __getattr__
exist, would be possible to further delay setting the default backend?
The issue arises when you want to build an application, and other people's code might be imported before yours. You are then at their mercy to not set the backend (implicitly!) before you set yours.
Proposed solution
No solution. I'm sure there is some strange historic thing I'm missing.
Honestly, you created a great API with pyplot. People use it to get colormaps, and for all sorts of things.