python 2.7 - Title of plot same as filename in matplotlib -


i want print title of plot, file name plotting. whatever files plots should title 'raman spectra of filename'. trying way doesn't work

   def onplot(self, event):     cursor= self.conn.execute("select file_name molecule mol_number==?", (self.plot_list[0],))     files = cursor.fetchall()     #print files[0][0]     tf = open(files[0][0],'r+') d = tf.readlines() tf.seek(0) line in d:          s=re.search(r'[a-za-z]',line)          if s:              tf.write('#'+line)          else:              tf.write(line)     tf.truncate()     tf.close()     plt.plotfile(str(files[0][0]), delimiter=' ',comments = '#', cols=(0, 1),                 names=('raman shift ($\mathregular{cm^{-1}}$)', 'intensity (arb. units)'), )      plt.title('raman spectra of "files"')     plt.show() 

the question little bit fuzzy:)

plt.title('raman spectra of {}'.format(files[0][0])) 

?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -