SciSharp/Numpy.NET

Plotting with matplotlib - need to avoid the default Tkinter

Closed this issue · 1 comments

tkinter (a python module installable by pip) is used by matplotlib by default as a backend ("TkAgg") to put a window on the screen.
tkinter has an issue due to the need for Tcl/tk (which is not installable from pip).
Even if Tcl/tk is installed it wont be found.

One solution is to change the backend. Either to "WebAgg" which will show in a browser window, or "Agg" which is headless.

//these two lines are needed only the first time
//Installer.TryInstallPip();
//await Installer.PipInstallModule("matplotlib");

dynamic mpl = Py.Import("matplotlib");
mpl.use("WebAgg");

Now I can plot !
Hope this helps someone else...

henon commented

OK, thanks for letting everyone know. I'll close it though because it is solved.