Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/bin/python
- #http://reasearch4.org
- #Simple 2dplotter.py that asks for a file input of comma separated data or txt file.
- #you can change the hard coding of the ax1.set_xlabel and _ylabel and title of graph.
- #the file to import must be in the local directory where you run the script from
- #if you dont enter the full path at the script raw_imput prompt. =^^=
- import matplotlib.pyplot as plt
- import numpy as np
- fileName = raw_input('enter the filename to plot,txt or csv --->')
- def graphex():
- x = []
- y = []
- readFile = open(fileName, 'r')
- sepFile = readFile.read().split('\n')
- readFile.close()
- fig = plt.figure()
- rect = fig.patch
- rect.set_facecolor('blue')
- for plotPair in sepFile:
- xandy = plotPair.split(',')
- x.append(int(xandy[0]))
- y.append(int(xandy[1]))
- ax1 = fig.add_subplot(1,1,1, axisbg='grey')
- ax1.plot(x,y, 'c',linewidth=3.3)
- ax1.set_title('Pwnagestatistics')
- ax1.set_xlabel('months_battling_evil')
- ax1.set_ylabel('Enemies_Pwnd!!!!')
- plt.show()
- graphex()
Advertisement
Add Comment
Please, Sign In to add comment