Matplotlib Crashing tkinter Application
You need to set the TkAgg backend explicitly. I could reproduce your bug. With the following code, the problem is resolved.
import matplotlibmatplotlib.use("TkAgg")from matplotlib import pyplot as plt
Note that setting the TkAgg backend after importing pyplot does not work either; it crashes too. You need to set it before importing pyplot. (Tested with MPL 1.4.3, tkinter.TkVersion 8.6)
If you don't want to edit the code, you can use set the following environment variable that matplotlib
is reading:
MPLBACKEND=TkAgg
This way, no matter when you import pyplot
, it'll work
@DonCristobal's answer helped me and therefore I tried to upvote or add a comment to it but stackoverflow prevents me from doing any of that citing certain points I must reach before I can comment or upvote. The solution suggested by @DonCristobal worked for my configuration given below:
Mac catalina, python 3.6 & matplotlib 3.0.3
Here is what i did -
Modified
import matplotlib.pyplot as plt
to
import matplotlibmatplotlib.use("TkAgg")from matplotlib import pyplot as plt