Exemple #1
0
    def plot(self, filename=None):
        import gist

        gist.window(self.id, wait=1)
        gist.pltitle(self.title)
        gist.animate(1)

        var = self.vars[0]

        if isinstance(var, FaceVariable):
            x, y = var.mesh.faceCenters
        elif isinstance(var, CellVariable):
            x, y = var.mesh.cellCenters

        gist.plmesh(numerix.array([y, y]), numerix.array([x, y]))

        vx = numerix.array(var[0])
        vy = numerix.array(var[1])

        maxVec = var.mag.max().value
        maxGrid = var.mesh._cellDistances.max()

        gist.plv(numerix.array([vy, vy]),
                 numerix.array([vx, vx]),
                 scale=maxGrid / maxVec * 3,
                 hollow=1,
                 aspect=0.25)  #,scale=0.002)

        if filename is not None:

            gist.hcp_file(filename)
            gist.hcp()

        gist.fma()
    def plot(self, filename=None):
        import gist

        gist.window(self.id, wait = 1)
        gist.pltitle(self.title)
        gist.animate(1)
        
        var = self.vars[0]
        
        if isinstance(var, FaceVariable):
            x, y = var.getMesh().getFaceCenters()
        elif isinstance(var, CellVariable):
            x, y = var.getMesh().getCellCenters()
        
        gist.plmesh(numerix.array([y, y]), numerix.array([x, y]))

        vx = numerix.array(var[0])
        vy = numerix.array(var[1])
        
        maxVec = var.getMag().max().getValue()
        maxGrid = var.getMesh()._getCellDistances().max()
        
        gist.plv(numerix.array([vy,vy]), numerix.array([vx,vx]), scale=maxGrid / maxVec * 3, hollow=1, aspect=0.25) #,scale=0.002)
        
        if filename is not None:
            
            gist.hcp_file(filename)
            gist.hcp()

        gist.fma()
Exemple #3
0
    def _plot(self):
        import gist

        gist.window(self.id, wait=1)
        gist.animate(1)
        gist.pltitle(self.title)
        gist.palette(self.palette)
        gist.gridxy(self.grid)

        if self.limits != None:
            gist.limits(self._getLimit('xmin'), self._getLimit('xmax'),
                        self._getLimit('ymin'), self._getLimit('ymax'))
Exemple #4
0
def movie(data,aslice,plen,loop=1,direc='z',cmax=None,cmin=None):
    "movie(data,slice,pause,loop=1,direc='z')"
    gist.animate(1)
    if type(aslice) is types.IntType:
        num = aslice
        aslice = [slice(None)]*3
        aslice[ord('x')-ord(direc)-1] = num
    for num in range(loop):
        for k in range(data.shape[0]):
            gist.fma()
            gist.pli(data[k][aslice],cmax=cmax,cmin=cmin)
            gist.pause(plen)
    gist.animate(0)
Exemple #5
0
def movie(data,aslice,plen,loop=1,direc='z',cmax=None,cmin=None):
    "movie(data,slice,pause,loop=1,direc='z')"
    gist.animate(1)
    if type(aslice) is types.IntType:
        num = aslice
        aslice = [slice(None)]*3
        aslice[ord('x')-ord(direc)-1] = num
    for num in range(loop):
        for k in range(data.shape[0]):
            gist.fma()
            gist.pli(data[k][aslice],cmax=cmax,cmin=cmin)
            gist.pause(plen)
    gist.animate(0)
Exemple #6
0
    def _plot(self):
        import gist
    
        gist.window(self.id, wait = 1)
        gist.animate(1)
        gist.pltitle(self.title)
        gist.palette(self.palette)
        gist.gridxy(self.grid)

        if self.limits != None:
            gist.limits(self._getLimit('xmin'), 
                        self._getLimit('xmax'), 
                        self._getLimit('ymin'), 
                        self._getLimit('ymax'))
Exemple #7
0
def imagesc(z,cmin=None,cmax=None,xryr=None,_style='default', palette=None,
            color='black',colormap=None):
    """Plot an image on axes.

    z -- The data
    cmin -- Value to map to lowest color in palette (min(z) if None)
    cmax -- Value to map to highest color in palette (max(z) if None)
    xryr -- (xmin, ymin, xmax, ymax) coordinates to print
            (0, 0, z.shape[1], z.shape[0]) if None
    _style -- A 'style-sheet' to use if desired (a default one will be used
              if 'default').  If None, then no style will be imposed.
    palette -- A string for a palette previously saved in a file (see write_palette)
               or an array specifying the red-green-blue values (2-d array N x 3) or
               gray-scale values (2-d array N x 1 or 1-d array).
    color -- The color to use for the axes.
    """
    if xryr is None:
        xryr = (0,0,z.shape[1],z.shape[0])
    try:
        _style = None
        saveval = gist.plsys(2)
        gist.plsys(saveval)
    except:
        _style = 'default'
        if not _hold:
            gist.fma()
        gist.animate(0)

    if _style is not None:
        if _style == "default":
            _style=os.path.join(_user_path,'image.gs')
            system = write_style.getsys(hticpos='below',vticpos='left',frame=1,
                                        color=color)
            fid = open(_style,'w')
            fid.write(write_style.style2string(system))
            fid.close()
        gist.window(style=_style)
        _current_style=_style
    if cmax is None:
        cmax = max(ravel(z))
    if cmin is None:
        cmin = min(ravel(z))
    cmax = float(cmax)
    cmin = float(cmin)
    byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)
    if (colormap is not None): palette=colormap
    change_palette(palette)
    gist.pli(byteimage,xryr[0],xryr[1],xryr[2],xryr[3])
    return
Exemple #8
0
def imagesc(z,cmin=None,cmax=None,xryr=None,_style='default', palette=None,
            color='black',colormap=None):
    """Plot an image on axes.

    z -- The data
    cmin -- Value to map to lowest color in palette (min(z) if None)
    cmax -- Value to map to highest color in palette (max(z) if None)
    xryr -- (xmin, ymin, xmax, ymax) coordinates to print
            (0, 0, z.shape[1], z.shape[0]) if None
    _style -- A 'style-sheet' to use if desired (a default one will be used
              if 'default').  If None, then no style will be imposed.
    palette -- A string for a palette previously saved in a file (see write_palette)
               or an array specifying the red-green-blue values (2-d array N x 3) or
               gray-scale values (2-d array N x 1 or 1-d array).
    color -- The color to use for the axes.
    """
    if xryr is None:
        xryr = (0,0,z.shape[1],z.shape[0])
    try:
        _style = None
        saveval = gist.plsys(2)
        gist.plsys(saveval)
    except:
        _style = 'default'
        if not _hold:
            gist.fma()
        gist.animate(0)

    if _style is not None:
        if _style == "default":
            _style=os.path.join(_user_path,'image.gs')
            system = write_style.getsys(hticpos='below',vticpos='left',frame=1,
                                        color=color)
            fid = open(_style,'w')
            fid.write(write_style.style2string(system))
            fid.close()
        gist.window(style=_style)
        _current_style=_style
    if cmax is None:
        cmax = max(ravel(z))
    if cmin is None:
        cmin = min(ravel(z))
    cmax = float(cmax)
    cmin = float(cmin)
    byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)
    if (colormap is not None): palette=colormap
    change_palette(palette)
    gist.pli(byteimage,xryr[0],xryr[1],xryr[2],xryr[3])
    return
    def plot(self, filename=None):
        import gist

        gist.window(self.id, wait=1, style=self.style)
        gist.pltitle(self.title)
        gist.animate(1)

        if self.limits != None:
            gist.limits(self._getLimit('xmin'), self._getLimit('xmax'),
                        self._getLimit(('datamin', 'ymin')),
                        self._getLimit(('datamax', 'ymax')))

        self._plotArrays()

        _GistViewer.plot(self, filename=filename)
Exemple #10
0
    def plot(self, filename = None):
        import gist

        gist.window(self.id, wait = 1, style = self.style)
        gist.pltitle(self.title)
        gist.animate(1)

        if self.limits != None:
            gist.limits(self._getLimit('xmin'), 
                        self._getLimit('xmax'), 
                        self._getLimit(('datamin', 'ymin')), 
                        self._getLimit(('datamax', 'ymax')))
            
        self._plotArrays()
            
        _GistViewer.plot(self, filename = filename)
Exemple #11
0
def imagesc_cb(z,cmin=None,cmax=None,xryr=None,_style='default',
               zlabel=None,font='helvetica',fontsize=16,color='black',
               palette=None):
    """Plot an image on axes with a colorbar on the side.

    z -- The data
    cmin -- Value to map to lowest color in palette (min(z) if None)
    cmax -- Value to map to highest color in palette (max(z) if None)
    xryr -- (xmin, ymin, xmax, ymax) coordinates to print
            (0, 0, z.shape[1], z.shape[0]) if None
    _style -- A 'style-sheet' to use if desired (a default one will be used
              if 'default').  If None, then no style will be imposed.
    palette -- A string for a palette previously saved in a file (see write_palette)
               or an array specifying the red-green-blue values (2-d array N x 3) or
               gray-scale values (2-d array N x 1 or 1-d array).
    zlabel -- The label to attach to the colorbar (font, fontsize, and color
              match this).
    color -- The color to use for the ticks and frame.
    """
    if xryr is None:
        xryr = (0,0,z.shape[1],z.shape[0])

    if not _hold:
        gist.fma()
    gist.animate(0)
    if _style is not None:
        if _style == 'default':
            _style=os.path.join(_user_path,"colorbar.gs")
            system = write_style.getsys(hticpos='below',vticpos='left',frame=1,color=color)
            fid = open(_style,'w')
            fid.write(write_style.style2string(system))
            fid.close()
        gist.window(style=_style)
        _current_style=_style
    if cmax is None:
        cmax = max(ravel(z))
    if cmin is None:
        cmin = min(ravel(z))
    cmax = float(cmax)
    cmin = float(cmin)

    change_palette(palette)

    byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)
    gist.pli(byteimage,xryr[0],xryr[1],xryr[2],xryr[3])
    colorbar.color_bar(cmin,cmax,ncol=240,zlabel=zlabel,font=font,fontsize=fontsize,color=color)
Exemple #12
0
def imagesc_cb(z,cmin=None,cmax=None,xryr=None,_style='default',
               zlabel=None,font='helvetica',fontsize=16,color='black',
               palette=None):
    """Plot an image on axes with a colorbar on the side.

    z -- The data
    cmin -- Value to map to lowest color in palette (min(z) if None)
    cmax -- Value to map to highest color in palette (max(z) if None)
    xryr -- (xmin, ymin, xmax, ymax) coordinates to print
            (0, 0, z.shape[1], z.shape[0]) if None
    _style -- A 'style-sheet' to use if desired (a default one will be used
              if 'default').  If None, then no style will be imposed.
    palette -- A string for a palette previously saved in a file (see write_palette)
               or an array specifying the red-green-blue values (2-d array N x 3) or
               gray-scale values (2-d array N x 1 or 1-d array).
    zlabel -- The label to attach to the colorbar (font, fontsize, and color
              match this).
    color -- The color to use for the ticks and frame.
    """
    if xryr is None:
        xryr = (0,0,z.shape[1],z.shape[0])

    if not _hold:
        gist.fma()
    gist.animate(0)
    if _style is not None:
        if _style == 'default':
            _style=os.path.join(_user_path,"colorbar.gs")
            system = write_style.getsys(hticpos='below',vticpos='left',frame=1,color=color)
            fid = open(_style,'w')
            fid.write(write_style.style2string(system))
            fid.close()
        gist.window(style=_style)
        _current_style=_style
    if cmax is None:
        cmax = max(ravel(z))
    if cmin is None:
        cmin = min(ravel(z))
    cmax = float(cmax)
    cmin = float(cmin)

    change_palette(palette)

    byteimage = gist.bytscl(z,cmin=cmin,cmax=cmax)
    gist.pli(byteimage,xryr[0],xryr[1],xryr[2],xryr[3])
    colorbar.color_bar(cmin,cmax,ncol=240,zlabel=zlabel,font=font,fontsize=fontsize,color=color)
Exemple #13
0
    def handle(self, data):
        """Handle data returned from the simulation"""
        if data[1] == "warning" or data[1] == "error":
            print "Error retrieving data", data[1:], data[0]
        elif len(self.gettype()) == 0:  #not doing anything with it...
            pass
        else:
            if self.when[:3] != "rpt" or self.repeating == 1:  #still expecting data
                if self.ret != None and data[3].has_key(self.ret):
                    data = data[3][self.ret]
                else:
                    data = None
                ret = self.ret
                if ret == None:
                    ret = "None"
                if self.button == None:
                    d = {ret: data, "button": None}
                else:
                    d = {ret: data, "button": self.button[0]}
                try:
                    exec self.preprocess in d
                except:
                    pass
                if self.button != None:
                    self.button[0] = d["button"]
                data = d[ret]
                dim = self.dim
                xaxis = self.xaxis
                if dim == None:
                    if type(data) == numpy.ndarray:
                        if len(data.shape) > 1:
                            dim = 2
                        elif len(data.shape) == 1:
                            dim = 1
                        else:
                            dim = 0
                    else:
                        dim = 0
                if dim == 1:
                    if type(self.xaxis) == types.NoneType:
                        if len(data.shape) > 1:
                            xaxis = data[0]
                            data = data[1:]
                        else:
                            xaxis = numpy.arange(data.shape[0])
                            data = data
                    else:
                        if type(self.xaxis) == types.StringType:
                            xaxis = eval(self.xaxis)
                if self.gisttype:
                    if type(data) == numpy.ndarray:
                        if not self.info.has_key("window"):
                            self.info["window"] = 0
                        if not self.info.has_key("palette"):
                            self.info["palette"] = "gray.gp"
                        if not self.info.has_key("gistdpi"):
                            self.info["gistdpi"] = 75
                        if self.gistWindow == None:
                            self.gistWindow = gist.window(
                                self.info["window"],
                                wait=1,
                                dpi=self.info["gistdpi"])
                            gist.animate(0)
                            gist.animate(1)
                            gist.palette(self.info["palette"])
                        else:
                            gist.window(self.gistWindow)
                        #gist.fma()
                        if dim == 1:
                            for i in range(data.shape[0]):
                                gist.plg(data[i], xaxis)
                        else:
                            gist.pli(data)
                        gist.fma()
                    else:
                        print "Cannot display type %s with gist" % str(
                            type(data))
                if self.pylabtype:
                    if type(data) == numpy.ndarray:
                        if not self.info.has_key("palette"):
                            self.info["palette"] = "gray"
                        if not self.info.has_key("interp"):
                            self.info["interp"] = "nearest"
                        if not self.info.has_key("plotwin"):
                            self.info["plotwin"] = mypylab.plot()
                            p = self.info["plotwin"]
                            p.win.set_title(self.title)
                            p.newPalette(self.info["palette"])
                            p.newInterpolation(self.info["interp"])
                            p.deactivatefn = self.cancel  #deactivate
                        p = self.info["plotwin"]
                        if dim == 1:
                            p.dims = 1
                            axis = xaxis
                        else:
                            p.dims = 2
                            axis = None
                        if p.active:
                            p.plot(data, axis=axis)
                        else:
                            if self.button != None:
                                self.button[0] = 0
                            #print "Not expecting this data any more... (simdata.handle, type=pylab)"
                            self.repeating = 0
                    else:
                        print "Cannot display type %s with pylab" % str(
                            type(data))

                if self.texttype:
                    #self.info["texttype"]=="ownwindow, mainwindow", default own
                    #self.info["replace"]==1 or 0, default 0
                    if not self.info.has_key("wintype"):
                        self.info["wintype"] = "ownwindow"
                    if not self.info.has_key("textreplace"):
                        self.info["textreplace"] = 0
                    if self.info["wintype"] == "ownwindow":
                        if self.textWindow == None:
                            self.textWindow = textbox(self.title)
                            self.textWindow.closeFunc = self.cancel  #deactivate
                        if self.textWindow.destroyed == 0:
                            #print "adding text",str(data)
                            self.textWindow.addText(
                                str(data) + "\n",
                                replace=self.info["textreplace"])
                        else:  #tell simulation not to send...
                            print "Not expecting this data any more... (simdata.handle, type=text)"
                            self.textWindow = None
                            self.repeating = 0
                    else:
                        print str(data)
                if self.savetype:
                    if not self.info.has_key("filetype"):
                        self.info["filetype"] = "fits"
                    if not self.info.has_key("filename"):
                        self.info["filename"] = "tmp.fits"
                    if not self.info.has_key("filereplace"):
                        self.info["filereplace"] = 0
                    if self.info["filetype"] == "fits":
                        if type(data) == numpy.ndarray:
                            print "WARNING - depreciated - use util.FITS instead (code needs updating)"
                            if self.info["filereplace"]:
                                imghdu = util.pyfits.PrimaryHDU(
                                    numarray.array(data))
                                imghdu.header.update("DATE", time.asctime())
                                imghdu.header.update("USER",
                                                     os.environ["USER"])
                                imghdu.header.update(
                                    "CREATOR", "simctrl.py simulation control")
                                imghdu.header.update("TITLE", str(self.title))
                                imghdu.header.update("COMMAND", str(self.cmd))
                                imghdu.header.update("RETURN", str(self.ret))
                                imghdu.header.update("TYPE", self.gettype())
                                imghdu.header.update("PREPROC",
                                                     str(self.preprocess))
                                imghdu.header.update("DIMS", str(self.dim))
                                imghdu.header.update("XAXIS", str(self.xaxis))
                                imghdu.header.update("WHEN", str(self.when))
                                imghdu.header.update("INFO", str(self.info))
                                hdulist = util.pyfits.HDUList([imghdu])
                                hdulist.writeto(self.info["filename"],
                                                clobber=True)
                            else:
                                f = util.pyfits.open(self.info["filename"],
                                                     mode="update")
                                imghdu = util.pyfits.ImageHDU(
                                    numarray.array(data))
                                imghdu.header.update("DATE", time.asctime())
                                imghdu.header.update("USER",
                                                     os.environ["USER"])
                                imghdu.header.update(
                                    "CREATOR", "simctrl.py simulation control")
                                imghdu.header.update("TITLE", str(self.title))
                                imghdu.header.update("COMMAND", str(self.cmd))
                                imghdu.header.update("RETURN", str(self.ret))
                                imghdu.header.update("TYPE", self.gettype())
                                imghdu.header.update("PREPROC",
                                                     str(self.preprocess))
                                imghdu.header.update("DIMS", str(self.dim))
                                imghdu.header.update("XAXIS", str(self.xaxis))
                                imghdu.header.update("WHEN", str(self.when))
                                imghdu.header.update("INFO", str(self.info))
                                f.append(imghdu)
                                f.close()
                        else:
                            print "Cannot save fits data of this format:", type(
                                data)
                    elif self.info["filetype"] == "csv":
                        if self.info["filereplace"]:
                            mode = "w"
                        else:
                            mode = "a"
                        f = open(self.info["filename"], mode)
                        f.write(
                            "#Date\t%s\n#User\t%s\n#Creator\tsimctrl.py simulation control\n#Title\t%s\n#Command\t%s\n#Return\t%s\n#Type\t%s\n#Preprocess\t%s\n#Dims\t%s\n#Xaxis\t%s\n#When\t%s\n#Info\t%s\n"
                            % (time.asctime(), os.environ["USER"],
                               str(self.title), str(self.cmd), str(self.ret),
                               self.gettype(), str(self.preprocess),
                               str(self.dim), str(self.xaxis), str(
                                   self.when), str(self.info)))
                        if dim == 1:
                            try:
                                for i in range(xaxis.shape[0]):
                                    f.write("%g" % float(xaxis[i]))
                                    for j in range(data.shape[0]):
                                        f.write("\t%g" % float(data[j][i]))
                                    f.write("\n")
                                f.write("\n")
                            except:
                                print "Data not in correct 1D format - can't save as csv"
                                f.write(str(data))
                                f.write("\n\n")
                        else:
                            print "Can't save 2D data as csv... using text instead"
                            f.write(str(data))
                            f.write("\n\n")
                        f.close()
                    elif self.info["filetype"] == "text":
                        if self.info["filereplace"]:
                            mode = "w"
                        else:
                            mode = "a"
                        f = open(self.info["filename"], mode)
                        f.write(
                            "#Date\t%s\n#User\t%s\n#Creator\tsimctrl.py simulation control\n#Title\t%s\n#Command\t%s\n#Return\t%s\n#Type\t%s\n#Preprocess\t%s\n#Dims\t%s\n#Xaxis\t%s\n#When\t%s\n#Info\t%s\n"
                            % (time.asctime(), os.environ["USER"],
                               str(self.title), str(self.cmd), str(self.ret),
                               self.gettype(), str(self.preprocess),
                               str(self.dim), str(self.xaxis), str(
                                   self.when), str(self.info)))
                        f.write(str(data))
                        f.write("\n\n")
                        f.close()
                    else:
                        print "Unrecognised filetype - not saving"
                if self.feedbacktype:
                    try:
                        d = {"feedback": data}
                        exec self.info["feedbackmsg"] in d
                        msg = d["msg"]
                    except:
                        msg = "Feedback data:" + str(data)
                    print msg
                exec self.post

            else:
                print "Warning: No longer expecting data for", self.cmd
Exemple #14
0
def plot(x,*args,**keywds):
    """Plot curves.

    Description:

      Plot one or more curves on the same graph.

    Inputs:

      There can be a variable number of inputs which consist of pairs or
      triples.  The second variable is plotted against the first using the
      linetype specified by the optional third variable in the triple.  If
      only two plots are being compared, the x-axis does not have to be
      repeated.
    """
    try:
        override = 1
        savesys = gist.plsys(2)
        gist.plsys(savesys)
    except:
        override = 0
    global _hold
    try: _hold=keywds['hold']
    except KeyError: pass
    try: linewidth=float(keywds['width'])
    except KeyError: linewidth=1.0
    try: msize = float(keywds['msize'])
    except KeyError: msize=1.0
    if _hold or override:
        pass
    else:
        gist.fma()
    gist.animate(0)
    savesys = gist.plsys()
    winnum = gist.window()
    if winnum < 0:
        gist.window(0)
    if savesys >= 0:
        gist.plsys(savesys)
    nargs = len(args)
    if nargs == 0:
        y = _minsqueeze(x)
        x = Numeric.arange(0,len(y))
        if numpy.iscomplexobj(y):
            print "Warning: complex data plotting real part."
            y = y.real
        y = where(numpy.isfinite(y),y,0)
        gist.plg(y,x,type='solid',color='blue',marks=0,width=linewidth)
        return
    y = args[0]
    argpos = 1
    nowplotting = 0
    clear_global_linetype()
    while 1:
        try:
            thearg = args[argpos]
        except IndexError:
            thearg = 0
        thetype,thecolor,themarker,tomark = _parse_type_arg(thearg,nowplotting)
        if themarker == 'Z':  # args[argpos] was data or non-existent.
            pass
            append_global_linetype(_rtypes[thetype]+_rcolors[thecolor])
        else:                 # args[argpos] was a string
            argpos = argpos + 1
            if tomark:
                append_global_linetype(_rtypes[thetype]+_rcolors[thecolor]+_rmarkers[themarker])
            else:
                append_global_linetype(_rtypes[thetype]+_rcolors[thecolor])
        if numpy.iscomplexobj(x) or numpy.iscomplexobj(y):
            print "Warning: complex data provided, using only real part."
            x = numpy.real(x)
            y = numpy.real(y)
        y = where(numpy.isfinite(y),y,0)
        y = _minsqueeze(y)
        x = _minsqueeze(x)
        gist.plg(y,x,type=thetype,color=thecolor,marker=themarker,marks=tomark,msize=msize,width=linewidth)

        nowplotting = nowplotting + 1

        ## Argpos is pointing to the next potential triple of data.
        ## Now one of four things can happen:
        ##
        ##   1:  argpos points to data, argpos+1 is a string
        ##   2:  argpos points to data, end
        ##   3:  argpos points to data, argpos+1 is data
        ##   4:  argpos points to data, argpos+1 is data, argpos+2 is a string

        if argpos >= nargs: break      # no more data

        if argpos == nargs-1:          # this is a single data value.
            x = x
            y = args[argpos]
            argpos = argpos+1
        elif type(args[argpos+1]) is types.StringType:
            x = x
            y = args[argpos]
            argpos = argpos+1
        else:   # 3
            x = args[argpos]
            y = args[argpos+1]
            argpos = argpos+2
    return
Exemple #15
0
def plot(x,*args,**keywds):
    """Plot curves.

    Description:

      Plot one or more curves on the same graph.

    Inputs:

      There can be a variable number of inputs which consist of pairs or
      triples.  The second variable is plotted against the first using the
      linetype specified by the optional third variable in the triple.  If
      only two plots are being compared, the x-axis does not have to be
      repeated.
    """
    try:
        override = 1
        savesys = gist.plsys(2)
        gist.plsys(savesys)
    except:
        override = 0
    global _hold
    try: _hold=keywds['hold']
    except KeyError: pass
    try: linewidth=float(keywds['width'])
    except KeyError: linewidth=1.0
    try: msize = float(keywds['msize'])
    except KeyError: msize=1.0
    if _hold or override:
        pass
    else:
        gist.fma()
    gist.animate(0)
    savesys = gist.plsys()
    winnum = gist.window()
    if winnum < 0:
        gist.window(0)
    if savesys >= 0:
        gist.plsys(savesys)
    nargs = len(args)
    if nargs == 0:
        y = _minsqueeze(x)
        x = numpy.arange(0,len(y))
        if numpy.iscomplexobj(y):
            print "Warning: complex data plotting real part."
            y = y.real
        y = where(numpy.isfinite(y),y,0)
        gist.plg(y,x,type='solid',color='blue',marks=0,width=linewidth)
        return
    y = args[0]
    argpos = 1
    nowplotting = 0
    clear_global_linetype()
    while 1:
        try:
            thearg = args[argpos]
        except IndexError:
            thearg = 0
        thetype,thecolor,themarker,tomark = _parse_type_arg(thearg,nowplotting)
        if themarker == 'Z':  # args[argpos] was data or non-existent.
            pass
            append_global_linetype(_rtypes[thetype]+_rcolors[thecolor])
        else:                 # args[argpos] was a string
            argpos = argpos + 1
            if tomark:
                append_global_linetype(_rtypes[thetype]+_rcolors[thecolor]+_rmarkers[themarker])
            else:
                append_global_linetype(_rtypes[thetype]+_rcolors[thecolor])
        if numpy.iscomplexobj(x) or numpy.iscomplexobj(y):
            print "Warning: complex data provided, using only real part."
            x = numpy.real(x)
            y = numpy.real(y)
        y = where(numpy.isfinite(y),y,0)
        y = _minsqueeze(y)
        x = _minsqueeze(x)
        gist.plg(y,x,type=thetype,color=thecolor,marker=themarker,marks=tomark,msize=msize,width=linewidth)

        nowplotting = nowplotting + 1

        ## Argpos is pointing to the next potential triple of data.
        ## Now one of four things can happen:
        ##
        ##   1:  argpos points to data, argpos+1 is a string
        ##   2:  argpos points to data, end
        ##   3:  argpos points to data, argpos+1 is data
        ##   4:  argpos points to data, argpos+1 is data, argpos+2 is a string

        if argpos >= nargs: break      # no more data

        if argpos == nargs-1:          # this is a single data value.
            x = x
            y = args[argpos]
            argpos = argpos+1
        elif type(args[argpos+1]) is types.StringType:
            x = x
            y = args[argpos]
            argpos = argpos+1
        else:   # 3
            x = args[argpos]
            y = args[argpos+1]
            argpos = argpos+2
    return