예제 #1
0
파일: tv.py 프로젝트: eddienko/SamPy
def lineplot(data,title='Line plot',symbol=None,X=None):
	from graph import GraphBase,GraphLine,GraphSymbols,GraphObjects 
	from plotAscii import PSprint,initSH
	SH = initSH()
	npt = []
	for i in range(len(data)):
	    if X != None:
		npt.append((X[i],data[i]))
	    else:
		npt.append((float(i),data[i]))
	top = Toplevel()
	top.title(title) 
	graph = GraphBase(top,300,300,relief=SUNKEN,border=2)

	w = string.atoi(graph.canvas.cget('width'))
	h = string.atoi(graph.canvas.cget('height'))
	bb  = graph._textBoundingBox(title)
	x = w/2-(bb[2]-bb[0])/2
	y = .05*h
	graph.canvas.create_text(x,y,text=title,anchor=W,font=SH['font'])

	line = GraphLine(npt,color='blue')
	# plot symbols
	if symbol != None:
	    npt_s = linesubset(npt)
	    linea = GraphSymbols(npt_s,color='blue',marker='circle',size=1.5,
		fillcolor='blue')
	    graphObject = GraphObjects([line,linea])
	else:
	    graphObject = GraphObjects([line])

	graph.pack(side=TOP,fill=BOTH,expand=YES)
	graph.draw(graphObject,'automatic','automatic')
	Button(top,text='Print',command=lambda g=graph,p=SH['printer']: PSprint(g,p)).pack(side=LEFT)
	Button(top,text='Close',command=top.destroy).pack(side=LEFT)
예제 #2
0
파일: tv.py 프로젝트: eddienko/SamPy
    def Print(self):
	if os.name == 'posix':
        	SH = initSH()
		printImage(self.fname,1,printer=SH['printer'])
	else:
		str = 'start '+ self.fname +' &'
		os.system(str)
예제 #3
0
파일: plot2d.py 프로젝트: eddienko/SamPy
    def startup(self):
      "startup(self) - initialize variables at object plot2d creation"
      from plotAscii import readST,loadpvs,initSH
      self.fig = 1
      self.NPT = -1
      self.imagetype = 0
      self.caption = 1
      self.column = 1
      self.interp = interp[0]
      self.SH = initSH()
      self.mdapath='.'
      self.mdafile=''
	
      if os.path.isfile('plot2d.config'):
        lines = readST('plot2d.config')
	self.fname = lines[0]
	if len(lines[0]) >2:
	    pth,fnm = os.path.split(lines[0])
	    self.txtpath = pth
	else :
	    self.txtpath='.'
        self.title = lines[1]
        self.xlabel = lines[2]
        self.ylabel = lines[3]
	self.mdapath = lines[4]
	self.Rg=['0','0','0','0','0','0']
      else:
	self.fname=''
	self.txtpath='.'
	self.title=''
	self.xlabel=''
	self.ylabel=''
	self.Rg=['0','0','0','0','0','0']
예제 #4
0
 def Print(self):
     if os.name == 'posix':
         SH = initSH()
         printImage(self.fname, 1, printer=SH['printer'])
     else:
         str = 'start ' + self.fname + ' &'
         os.system(str)
예제 #5
0
def scatterplot(data, title='Scatter plot', symbol=None, X=None):
    "multiline scater plot"
    from graph import GraphBase, GraphLine, GraphSymbols, GraphObjects
    from plotAscii import PSprint, initSH
    SH = initSH()
    try:
        npt = len(data[0])
    except TypeError:
        print 'Input Error, multiple line vectors required'
        return
    rows = len(data)
    top = Toplevel()
    top.title(title)
    graph = GraphBase(top, 300, 300, relief=SUNKEN, border=2)
    w = string.atoi(graph.canvas.cget('width'))
    h = string.atoi(graph.canvas.cget('height'))
    bb = graph._textBoundingBox(title)
    x = w / 2 - (bb[2] - bb[0]) / 2
    y = .05 * h
    graph.canvas.create_text(x, y, text=title, anchor=W, font=SH['font'])

    #    markers=['circle','square','cross','plus','dot','triangle','triangle_down']
    lines = []
    for j in range(rows):
        npt = []
        da = data[j]
        npts = len(da)
        if X != None:
            xa = X[j]
            if len(xa) < npts: xa = range(npts)
        else:
            xa = range(npts)
        for i in range(npts):
            npt.append((xa[i], da[i]))
        line = GraphLine(npt, color='blue')
        lines.append(line)
        # plot symbols
        if symbol != None:
            npt_s = linesubset(npt)
            #	    sym = markers[j%7]
            linea = GraphSymbols(npt_s,
                                 color='blue',
                                 marker='circle',
                                 size=1.5,
                                 fillcolor='blue')
            lines.append(linea)

    graphObject = GraphObjects(lines)
    graph.pack(side=TOP, fill=BOTH, expand=YES)
    graph.draw(graphObject, 'automatic', 'automatic')
    Button(
        top,
        text='Print',
        command=lambda g=graph, p=SH['printer']: PSprint(g, p)).pack(side=LEFT)
    Button(top, text='Close', command=top.destroy).pack(side=LEFT)
    top.mainloop()
예제 #6
0
파일: tv.py 프로젝트: eddienko/SamPy
   def body(self,master):
        self.title("Set Printer Dialog")
        self.label = StringVar()
        Label(master, text='Enter Printer Name:').grid(row=1, sticky=W)
        self.label = Entry(master, width = 26 )
        self.label.grid(row=1,column=1)   
	SH = initSH()
        self.label.insert(0,SH['printer'])
	self.SH = SH
        return self.label
예제 #7
0
 def body(self, master):
     self.title("Set Printer Dialog")
     self.label = StringVar()
     Label(master, text='Enter Printer Name:').grid(row=1, sticky=W)
     self.label = Entry(master, width=26)
     self.label.grid(row=1, column=1)
     SH = initSH()
     self.label.insert(0, SH['printer'])
     self.SH = SH
     return self.label
예제 #8
0
파일: tv.py 프로젝트: eddienko/SamPy
def scatterplot(data,title='Scatter plot',symbol=None,X=None):
    "multiline scater plot"
    from graph import GraphBase,GraphLine,GraphSymbols,GraphObjects 
    from plotAscii import PSprint,initSH
    SH = initSH()
    try:
        npt = len(data[0]) 
    except TypeError:
	print 'Input Error, multiple line vectors required'
	return	
    rows = len(data)
    top = Toplevel()
    top.title(title) 
    graph = GraphBase(top,300,300,relief=SUNKEN,border=2)
    w = string.atoi(graph.canvas.cget('width'))
    h = string.atoi(graph.canvas.cget('height'))
    bb  = graph._textBoundingBox(title)
    x = w/2-(bb[2]-bb[0])/2
    y = .05*h
    graph.canvas.create_text(x,y,text=title,anchor=W,font=SH['font'])


#    markers=['circle','square','cross','plus','dot','triangle','triangle_down']
    lines = []
    for j in range(rows):
	npt = []
	da = data[j]
	npts = len(da)
	if X != None: 
		xa = X[j]
		if len(xa) < npts: xa = range(npts)
	else: 
		xa = range(npts)
	for i in range(npts): npt.append((xa[i],da[i]))
	line = GraphLine(npt,color='blue')
	lines.append(line)
	# plot symbols
	if symbol != None:
	    npt_s = linesubset(npt)
#	    sym = markers[j%7]
	    linea = GraphSymbols(npt_s,color='blue',marker='circle',size=1.5,
		fillcolor='blue')
	    lines.append(linea)

    graphObject = GraphObjects(lines)
    graph.pack(side=TOP,fill=BOTH,expand=YES)
    graph.draw(graphObject,'automatic','automatic')
    Button(top,text='Print',command=lambda g=graph,p=SH['printer']: PSprint(g,p)).pack(side=LEFT)
    Button(top,text='Close',command=top.destroy).pack(side=LEFT)
    top.mainloop()
예제 #9
0
파일: plot1d.py 프로젝트: eddienko/SamPy
    def startup(self):
      "startup(self) - initialize variables at object plot1d creation"
      from plotAscii import readST,loadpvs,initSH
      self.CBframe = -1
      self.nc = -1
      self.fig = 0
      self.symOn = 0
      self.legOn = 1
      self.spp = 1
      self.styOn = 0
      self.legloc = 0
      self.pvs = loadpvs()
      self.linestyles = linestyles
      self.colors = colors
      self.symbols = symbols
      self.SH = initSH()
      self.stdFrame = None
      self.fitFrame = None
      self.histFrame = None
      self.errFrame = None
      self.legFrame = None
      self.Fit = None
      self.setXFrame = None
	
      if os.path.isfile('plot1d.config'):
        lines = readST('plot1d.config')
	self.fname = lines[0]
	if len(lines[0]) >2:
	    pth,fnm = os.path.split(lines[0])
	    self.txtpath = pth
	else :
	    self.txtpath='.'
        self.title = lines[1]
        self.xlabel = lines[2]
        self.ylabel = lines[3]
	self.mdapath = lines[4]
	self.Rg=['0','100','0','100']
      else:
	self.fname=''
	self.txtpath='.'
	self.mdapath='.'
	self.title=''
	self.xlabel=''
	self.ylabel=''
	self.Rg=['0','100','0','100']
예제 #10
0
def lineplot(data, title='Line plot', symbol=None, X=None):
    from graph import GraphBase, GraphLine, GraphSymbols, GraphObjects
    from plotAscii import PSprint, initSH
    SH = initSH()
    npt = []
    for i in range(len(data)):
        if X != None:
            npt.append((X[i], data[i]))
        else:
            npt.append((float(i), data[i]))
    top = Toplevel()
    top.title(title)
    graph = GraphBase(top, 300, 300, relief=SUNKEN, border=2)

    w = string.atoi(graph.canvas.cget('width'))
    h = string.atoi(graph.canvas.cget('height'))
    bb = graph._textBoundingBox(title)
    x = w / 2 - (bb[2] - bb[0]) / 2
    y = .05 * h
    graph.canvas.create_text(x, y, text=title, anchor=W, font=SH['font'])

    line = GraphLine(npt, color='blue')
    # plot symbols
    if symbol != None:
        npt_s = linesubset(npt)
        linea = GraphSymbols(npt_s,
                             color='blue',
                             marker='circle',
                             size=1.5,
                             fillcolor='blue')
        graphObject = GraphObjects([line, linea])
    else:
        graphObject = GraphObjects([line])

    graph.pack(side=TOP, fill=BOTH, expand=YES)
    graph.draw(graphObject, 'automatic', 'automatic')
    Button(
        top,
        text='Print',
        command=lambda g=graph, p=SH['printer']: PSprint(g, p)).pack(side=LEFT)
    Button(top, text='Close', command=top.destroy).pack(side=LEFT)
예제 #11
0
파일: 3dgraph.py 프로젝트: eddienko/SamPy
    def Print(self):
	'Print(self) - send PS 3D canvas plot to printer'
	from plotAscii import PSprint
	SH = initSH()
	PSprint(self,printer=SH['printer'])
예제 #12
0
파일: 3dgraph.py 프로젝트: RainW7/SamPy
 def Print(self):
     'Print(self) - send PS 3D canvas plot to printer'
     from plotAscii import PSprint
     SH = initSH()
     PSprint(self, printer=SH['printer'])