示例#1
0
    def __init__(self,
                 timelines,
                 custom,
                 showWindow=True,
                 registry=None):
        """@param timelines: The timelines object
        @type timelines: TimeLineCollection
        @param custom: A CustomplotInfo-object. Values in this object usually override the
        other options
        """

        self.hasSubplotHost=True
        try:
            global plt,matplotlib,firstTimeImport,SubplotHost
            import matplotlib
            if not showWindow and firstTimeImport:
#                matplotlib.use("MacOSX")
                matplotlib.use("agg")
                firstTimeImport=False
            import matplotlib.pyplot as plt
            try:
                from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
            except ImportError:
                self.hasSubplotHost=False
                warning("Matplotlib-Version does not support SubplotHost")
        except ImportError:
            error("Matplotlib not installed.")
    
        GeneralPlotTimelines.__init__(self,timelines,custom,showWindow=showWindow,registry=registry)

        self.figNr=MatplotlibTimelines.figureNr
        MatplotlibTimelines.figureNr+=1

        self.figure=None
        self.title=""
        
        self.ylabel=""
        self.ylabel2=""
        try:
            if self.spec.ylabel:
                self.setYLabel(self.spec.ylabel)
        except AttributeError:
            pass
        try:
            if self.spec.y2label:
                self.setYLabel2(self.spec.y2label)
        except AttributeError:
            pass
        
        self.axis1=None
        self.axis2=None

        self.setTitle(self.spec.theTitle)

        self.with_=self.spec.with_
        if not self.with_ in ['lines','points','dots','steps','linespoints']:
            warning("'with'-style",self.with_,"not implemented, using 'lines'")
            self.with_='lines'
        self.redo()
示例#2
0
    def __init__(self,
                 timelines,
                 custom,
                 showWindow=True,
                 registry=None):
        """@param timelines: The timelines object
        @type timelines: TimeLineCollection
        @param custom: A CustomplotInfo-object. Values in this object usually override the
        other options
        """

        try:
            global Qt,Qwt,app
            
            from PyQt4 import Qt
            import PyQt4.Qwt5 as Qwt
            
            if showWindow and app==None:
                app = Qt.QApplication([])
                #                app.thread()
        except ImportError:
            error("Could not import Qt4 or Qwt")
    
        GeneralPlotTimelines.__init__(self,timelines,custom,showWindow=showWindow,registry=registry)

        self.figNr=QwtPlotTimelines.figureNr
        QwtPlotTimelines.figureNr+=1

        self.figure=None
        self.title="no title"
        
        self.ylabel="no label"
        self.ylabel2="no label"
        try:
            if self.spec.ylabel:
                self.setYLabel(self.spec.ylabel)
        except AttributeError:
            pass
        try:
            if self.spec.y2label:
                self.setYLabel2(self.spec.y2label)
        except AttributeError:
            pass
        
        self.axis1=None
        self.axis2=None

        self.setTitle(self.spec.theTitle)

        self.with_=self.spec.with_
        if not self.with_ in ['lines']:
            warning("'with'-style",self.with_,"not implemented, using 'lines'")
            self.with_='lines'

        self.curves={}
        
        self.redo()
示例#3
0
    def __init__(self,
                 timelines,
                 custom,
                 showWindow=True,
                 registry=None):
        """@param timelines: The timelines object
        @type timelines: TimeLineCollection
        @param custom: A CustomplotInfo-object. Values in this object usually override the
        other options
        """

        GeneralPlotTimelines.__init__(self,timelines,custom,showWindow=showWindow,registry=registry)
        
        self.redo()
示例#4
0
    def __init__(self,
                 timelines,
                 custom,
                 showWindow=True,
                 registry=None):
        """@param timelines: The timelines object
        @type timelines: TimeLineCollection
        @param custom: A CustomplotInfo-object. Values in this object usually override the
        other options
        """

        GeneralPlotTimelines.__init__(self,timelines,custom,showWindow=showWindow,registry=registry)
        Gnuplot.__init__(self,persist=self.spec.persist)

        self.itemlist=[]
            
        if self.spec.start or self.spec.end:
            rng="["
            if self.spec.start:
                rng+=str(self.spec.start)
            rng+=":"
            if self.spec.end:
                rng+=str(self.spec.end)
            rng+="]"
            self.set_string("xrange "+rng)
            
        if len(self.alternate)>0:
            self.set_string("y2tics")

        try:
            if self.spec.logscale:
                self.set_string("logscale y")
        except AttributeError:
            pass

        try:
            if self.spec.ylabel:
                self.set_string('ylabel "'+self.spec.ylabel+'"')
        except AttributeError:
            pass
        
        try:
            if self.spec.y2label:
                self.set_string('y2label  "'+self.spec.y2label+'"')
        except AttributeError:
            pass

        raiseit=False
        if "raiseit" in dir(self.spec):
            raiseit=self.spec.raiseit
        if raiseit:
            x11addition=" raise"
        else:
            x11addition=" noraise"

        if showWindow:
            if uname()[0]=="Darwin":
                self.set_string("terminal x11"+x11addition)
                # self.set_string("terminal aqua "+str(GnuplotTimelines.terminalNr))
                GnuplotTimelines.terminalNr+=1
            else:
                self.set_string("terminal x11"+x11addition)
        else:
            self.set_string("terminal dumb")
            
        self.with_=self.spec.with_
        
        self.redo()