I am using Python 2.7 and matplotlib to create a simple plot window on Ubuntu 12.10.
When plt.plot()
is called, an empty windows comes up, but closes instantaneously, without displaying any figure inside it, only a grey background. However, if I try with plt.savefig('name')
the correct figure is saved.
Also, I guess it is important to mention that I do have plt.show()
at the end. A plot window does appear, it's just blank.
Some code:
def plot(self):
# Plotting the track
coordinates = np.genfromtxt(self.data, delimiter=self.coord_delimiter)
plt.plot(coordinates[:, 0:1], coordinates[:, 1:2], linestyle='-', color=self.track_color, linewidth='2')
plt.savefig('m1') # This works
plt.show()
What could cause the plot window to be blank, but the saved image to be correct?