What the title says. Is there a way to use the matplotlib library without installing TCL? Please do not tell me to bite the bullet and install TCL. I know how to do this, but for my own (maybe stupid) reasons why I don't want to.
I do not need to display graphics, I only want to display them in png. I tried different things (using different backends, etc.), but matplotlib always wanted to find tcl to work :( Why is TCL so important for matplotlib?
Also note that I use windows - I installed everything that may be required (numpy, pandas, matplotlib) using pip.
@Gerrit's solution is correct (I tried to change the backends, but I did it after loading pyplot - it is important that you need to change the backend immediately after creating matplotlib). Here is a small example of its use:
import matplotlib
matplotlib.use ('Agg')
import matplotlib.pyplot as plt
fig, ax = plt.subplots (nrows = 1, ncols = 1)
ax.plot ([0,1,2], [10,20,3])
fig.savefig ('foo.png')
plt.close (fig)
This will exit the file named 'foo.png' without using TCL \ o /
source
share