Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to set the matplotlib backend used by plot()

SageMath uses matplotlib as its graphics engine and the module itself can work with many backends. But how can I set a GUI matplotlib backend to be used by the plot() function and its friends, at least in the command-line interface? And is there a way to set a default backend?

In my setup, plot() doesn't respect the backend set by the %matplotlib magic, but matplotlib.pyplot.plot() does. Even worse, the default backend creates a PNG image file and opens it in the system's viewer.

I'm on macOS 10.13 "High Sierra" running SageMath 9.1, the binary app version.