Esempio n. 1
0
    def plotMemberProfiles( self, *name, **arg ):
        """
        Plot profiles of all member trajectories seperately::
          plotMemberProfiles( name1, [name2, .. ],[ arg1=x,..])
            -> biggles.Table

        @param name: profile name(s)
        @type  name: str
        @param arg: pairs for biggles.Curve() and/or xlabel=..,ylabel=..
        @type  arg: key=value

        @return: biggles plot object
        @rtype: biggles.FramedArray()   
        """
        if not biggles:
            raise ImportError, 'biggles module could not be imported.'
        
        rows = self.n_members / 2 + self.n_members % 2
        page = biggles.FramedArray( rows , 2)

        biggles.configure('fontsize_min', 1)
        colors = T.colorSpectrum( len( name ) , '00FF00', 'FF00FF') 

        ml = self.memberList()

        i = 0
        minV = maxV = None

        for t in ml:

            for j in range( len(name)):

                p = t.profile( name[j] )

                if minV is None or minV > min( p ):
                    minV = min(p)
                if maxV is None or maxV < max( p ):
                    maxV = max(p)

                page[i/2, i%2].add( biggles.Curve( range( len(p) ), list(p),
                                                   color=colors[j], **arg ) )

                page[i/2, i%2].add( biggles.PlotLabel( 0.8, 0.8-j/8.0, name[j],
                                                       color=colors[j]) )

            page[i/2, i%2].add( biggles.PlotLabel( 0.1, 0.9, 'Traj %i' % i))

            i += 1

        if self.n_members % 2 != 0:
            line = biggles.Line( (0,minV), (len(p),maxV) )
            page[ self.n_members/2, 1 ].add( line )

        page.uniform_limits = 1
        page.xlabel = arg.get('xlabel',None)
        page.ylabel = arg.get('ylabel',None)

        return page
Esempio n. 2
0
    def plot( self, xkey, *ykey, **arg ):
        """
        Plot pairs of info values. The additional arg arguments are handed
        over to biggles.Points().::
          plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y]) -> biggles.FramedPlot

        @param xkey: key specifying x-values
        @type  xkey: str
        @param ykey: key specifying y-values
        @type  ykey: str OR [str]
        @param arg: additional biggles arguments
        @type  arg: key=value

        @return: biggles plot object
        @rtype: biggles.FramedPlot()
        """
        if not biggles:
            raise ImportError, 'biggles module could not be imported.'
        
        plot = biggles.FramedPlot()

        plot.xlabel = xkey

        colors = t.colorSpectrum( len( ykey ) )

        if not 'size' in arg:
            arg['size'] = 1

        for i in range( len(ykey)):

            x = self.valuesOf( xkey )
            y = self.valuesOf( ykey[i] )

            x, y = self.__maskNone( x, y )

            plot.add( biggles.Points( x, y, color=colors[i], **arg ) )

            plot.add( biggles.PlotLabel( 0.2, 0.95-i/8.0, ykey[i],
                                         color=colors[i] ) )

        return plot
Esempio n. 3
0
    def plot( self, xkey, *ykey, **arg ):
        """
        Plot pairs of info values. The additional arg arguments are handed
        over to biggles.Points().::
          plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y]) -> biggles.FramedPlot

        @param xkey: key specifying x-values
        @type  xkey: str
        @param ykey: key specifying y-values
        @type  ykey: str OR [str]
        @param arg: additional biggles arguments
        @type  arg: key=value

        @return: biggles plot object
        @rtype: biggles.FramedPlot()
        """
        if not biggles:
            raise ImportError, 'biggles module could not be imported.'
        
        plot = biggles.FramedPlot()

        plot.xlabel = xkey

        colors = t.colorSpectrum( len( ykey ) )

        if not 'size' in arg:
            arg['size'] = 1

        for i in range( len(ykey)):

            x = self.valuesOf( xkey )
            y = self.valuesOf( ykey[i] )

            x, y = self.__maskNone( x, y )

            plot.add( biggles.Points( x, y, color=colors[i], **arg ) )

            plot.add( biggles.PlotLabel( 0.2, 0.95-i/8.0, ykey[i],
                                         color=colors[i] ) )

        return plot
Esempio n. 4
0
    def plotMemberProfiles(self, *name, **arg):
        """
        Plot profiles of all member trajectories seperately::
          plotMemberProfiles( name1, [name2, .. ],[ arg1=x,..])
            -> biggles.Table

        @param name: profile name(s)
        @type  name: str
        @param arg: pairs for biggles.Curve() and/or xlabel=..,ylabel=..
        @type  arg: key=value

        @return: biggles plot object
        @rtype: biggles.FramedArray()   
        """
        if not biggles:
            raise ImportError, 'biggles module could not be imported.'

        rows = self.n_members / 2 + self.n_members % 2
        page = biggles.FramedArray(rows, 2)

        biggles.configure('fontsize_min', 1)
        colors = T.colorSpectrum(len(name), '00FF00', 'FF00FF')

        ml = self.memberList()

        i = 0
        minV = maxV = None

        for t in ml:

            for j in range(len(name)):

                p = t.profile(name[j])

                if minV is None or minV > min(p):
                    minV = min(p)
                if maxV is None or maxV < max(p):
                    maxV = max(p)

                page[i / 2, i % 2].add(
                    biggles.Curve(range(len(p)),
                                  list(p),
                                  color=colors[j],
                                  **arg))

                page[i / 2, i % 2].add(
                    biggles.PlotLabel(0.8,
                                      0.8 - j / 8.0,
                                      name[j],
                                      color=colors[j]))

            page[i / 2, i % 2].add(biggles.PlotLabel(0.1, 0.9, 'Traj %i' % i))

            i += 1

        if self.n_members % 2 != 0:
            line = biggles.Line((0, minV), (len(p), maxV))
            page[self.n_members / 2, 1].add(line)

        page.uniform_limits = 1
        page.xlabel = arg.get('xlabel', None)
        page.ylabel = arg.get('ylabel', None)

        return page