# 2008-06-07 (Sat): -1.1; wit -> with_ import Gnuplot, tempfile, os class Gplot(Gnuplot.Gnuplot): def __init__(self, filename='default.gps'): Gnuplot.Gnuplot.__init__(self) if os.uname()[0] == 'Darwin': self.__call__('set term aqua font "lucida,16"') self.__call__('set zeroaxis') self.__call__('set format "%.1f') try: fps = open(filename) except IOError: pass else: fps.close() self.__call__('load "%s"' % filename) def plot(self, x, y, y2=None, x2=None, style="lines lw 1.5", style2="points pt 5 ps 1.2"): if y2 != None: if x2 != None: Gnuplot.Gnuplot.plot(self, Gnuplot.Data(x, y, with_=style), Gnuplot.Data(x2, y2, with_=style2)) else: Gnuplot.Gnuplot.plot(self, Gnuplot.Data(x, y, with_=style), Gnuplot.Data(x, y2, with_=style2)) else: Gnuplot.Gnuplot.plot(self, Gnuplot.Data(x, y, with_=style)) # def fplot(self, filename="default.gps"): # ft = tempfile.mktemp() # self.__call__('save term "%s"' % ft) # self.__call__('load "%s"' % filename) # Gnuplot.Gnuplot.replot(self) # self.__call__('load "%s"' % ft) def plot2(self, x, y, style="linespoints"): Gnuplot.Gnuplot.plot(self, Gnuplot.Data(x, y, with_=style)) def plot1(self, x, style="linespoints"): Gnuplot.Gnuplot.plot(self, Gnuplot.Data(x[0], x[1], with_=style))