dimanche 19 juin 2016

Simple script hangs creating and/or saving figure with matplotlib


I'm running Python 2.7.11+ and matplotlib 1.5.1 on Ubuntu 16.04 64 bit.

The very simple script shown below hangs at either of the three lines marked. If I leave all lines un-commented, it will hang on the first one. If I comment it out, it will hang on the second one. Same with the third one.

No error or warning shows, it just never goes beyond any of those lines.

What could be the reason for this? A bad matplotlib installation? How can I check this, because it seems like it is properly installed.

import matplotlib.pyplot as plt

print 'Hangs here v'
plt.figure(figsize=(15, 10))

plt.scatter([0.3, 2.7], [0.5, 1.5])

print 'Also hangs here v'
plt.show()

print 'Also here v'
plt.savefig('test.png')

Aucun commentaire:

Enregistrer un commentaire