lolamontes69

scatterplot using gnuplot.py

Aug 17th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import Gnuplot as Gnuplot
  2. import Gnuplot, Gnuplot.funcutils
  3. from numpy import *
  4.  
  5. def plotagematches(rows):
  6.     xdm,ydm=[r.data[0] for r in rows if r.match==1],\
  7.             [r.data[1] for r in rows if r.match==1]
  8.     xdn,ydn=[r.data[0] for r in rows if r.match==0],\
  9.             [r.data[1] for r in rows if r.match==0]
  10.     listm=[]
  11.     for fr in range(len(xdm)):
  12.         dep=(xdm[fr],ydm[fr])
  13.         listm.append(dep)
  14.     listn=[]
  15.     for fr in range(len(xdn)):
  16.         dep=(xdn[fr],ydn[fr])
  17.         listn.append(dep)
  18.     g = Gnuplot.Gnuplot(debug=1)
  19.     plot1 = Gnuplot.PlotItems.Data(listm, with_="points 1", title=None)
  20.     plot2 = Gnuplot.PlotItems.Data(listn, with_="points 3", title=None)  # No title
  21.     g.title('plotage matches')
  22.     g.plot(plot1,plot2)
  23.     wait=raw_input('Press <ENTER> to continue')
Advertisement
Add Comment
Please, Sign In to add comment