Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlibs pyplot.subplots() crashes kernel

Using matplotlibs pyplot (in this case imported as plt) crashes my kernel (Py3.5 under Win7) when using more than 1 plot. More specifically, the axes obejct results in a crash. The crash is immediatly and killing all running python instances.

E.g. calling

fig,ax = plt.subplots(2,2)

crashes. While

ret = plt.subplots(2,2)
fig = ret[0]

works, and then crashes when calling

ax = ret[1]

or

ax1 = ret[1][0]

or similar

Is this a known issue?

like image 914
Max Avatar asked Apr 21 '16 09:04

Max


1 Answers

I too faced a similar issue but I could get rid of the crashing problem using this way.

import matplotlib
matplotlib.use("TKAgg")
import matplotlib.pyplot as plt

fig,ax=plt.subplots(1, 1)

This worked for me. Give it a try.

Hope it helps.

Best Wishes

like image 200
RITI Avatar answered Oct 17 '22 05:10

RITI