0

I'm using python 2.7 on Ubuntu to draw charts from text files containing data.

My point is, when using python executables in shell, I have no problem recording plots, but if I want them shown on my screen instead I have to go through the graphic interface. If possible, I would very much like to skip that part and get a dynamic display that I can interact with (as if I were to run my script from a python shell)!!

a MWE of what i'm doing is :

MWE

import numpy as np
import matplotlib.pyplot as plt
with open('filename','r') as myfile: 
   DATA = np.genfromtxt(myfile,unpack=True)

   fig = plt.figure()

... my plot configuration ...

plt.savefig("image_name"+'.png')
plt.close()

end of MWE

Using this script image_name.png appears in my repertory. I tried replacing the last 2 lines with plt.plot() and plt.draw() but nothing happened.

Many thanks! Michel

(edited)

Michel
  • 13
  • 4
  • Uhm. Display how, ASCII? You can't display graphics in a shell. – runDOSrun Feb 03 '15 at 10:21
  • Try using ``plt.show()`` to display an interactive version of your plot. – Simon Gibbons Feb 03 '15 at 10:25
  • Well I was hoping I could display the chart the same way it is displayed when running from spyder with plt.plot(), or at least skip the part where I go through the graphic interface using an alias : "alias = 'python_script xdg-open image_name.png' " but this doesn't work either :/ – Michel Feb 03 '15 at 10:32

0 Answers0