Example #1
0
 def __init__(self,
              colorlegend,
              x,
              y,
              w,
              h,
              ngrid=0,
              linewidth=None,
              nlabel=-1,
              font=None,
              size=None,
              dec=2,
              scale=0,
              lefttext=False,
              **kargs):
     """Initialize the ColorLegend."""
     Decoration.__init__(self, x, y, **kargs)
     self.cl = colorlegend
     self.w = int(w)
     self.h = int(h)
     self.ngrid = int(ngrid)
     if self.ngrid < 0:
         self.ngrid = len(self.cl.colors)
         if self.ngrid > 50:
             self.ngrid = 0
     self.linewidth = saneLineWidth(linewidth)
     self.nlabel = int(nlabel)
     if self.nlabel < 0:
         self.nlabel = len(self.cl.colors)
     self.font = gluttext.glutSelectFont(font, size)
     self.dec = dec  # number of decimals
     self.scale = 10**scale  # scale all numbers with 10**scale
     self.lefttext = lefttext
     self.xgap = 4  # hor. gap between color bar and labels
     self.ygap = 4  # (min) vert. gap between labels
Example #2
0
    def __init__(self,text,x,y,font='9x15',size=None,gravity=None,color=None,zoom=None,**kargs):
        """Create a text actor"""
        Decoration.__init__(self,x,y,**kargs)
        self.text = str(text)
        self.font = gluttext.glutSelectFont(font,size)

        if gravity is None:
            gravity = 'E'
        self.gravity = gravity
        self.color = saneColor(color)
        self.zoom = zoom
Example #3
0
 def __init__(self,colorlegend,x,y,w,h,font=None,size=None,dec=2,scale=0,grid=0,linewidth=None,lefttext=False,nlabels=-1):
     Decoration.__init__(self,x,y)
     self.cl = colorlegend
     self.w = int(w)
     self.h = int(h)
     self.xgap = 4  # hor. gap between colors and labels 
     self.ygap = 4  # vert. gap between labels
     #self.font = getFont(font,size)
     self.font = gluttext.glutSelectFont(font,size)
     self.dec = dec   # number of decimals
     self.scale = 10 ** scale # scale all numbers with 10**scale
     self.grid = abs(int(grid))
     self.linewidth = saneLineWidth(linewidth)
     self.lefttext = lefttext
Example #4
0
    def __init__(self,pos,val,color=black,font='sans',size=18):
        """Create a number list.

        pos is an (N,3) array of positions.
        val is an (N,) array of marks to be plot at those positions.

        While intended to plot integer numbers, val can be any object
        that allows index operations for the required length N and allows
        its items to be formatted as a string.
        """
        if len(val) < len(pos):
            raise ValueError,"Not enough values for positions"
        Mark.__init__(self,pos)
        self.val = val
        self.color = saneColor(color)
        self.font = gluttext.glutSelectFont(font,size)
Example #5
0
    def __init__(self, text, x, y, font="9x15", size=None, gravity=None, adjust=None, color=None, zoom=None):
        """Create a text actor"""
        Decoration.__init__(self, x, y)
        self.text = str(text)
        self.font = gluttext.glutSelectFont(font, size)
        if adjust is not None:
            import warnings

            warnings.warn("The 'adjust' parameter should no longer be used. Use 'gravity' intead.", DeprecationWarning)

            gravity = {"left": "W", "right": "E", "center": "C", "under": "N", "above": "S"}[adjust]

        if gravity is None:
            gravity = "E"
        self.gravity = gravity
        self.color = saneColor(color)
        self.zoom = zoom
Example #6
0
    def __init__(self,pos,val,color=black,font='sans',size=18,leader='',gravity='',**kargs):
        """Create a number list.

        pos is an (N,3) array of positions.
        val is an (N,) array of marks to be plot at those positions.

        While intended to plot integer numbers, val can be any object
        that allows index operations for the required length N and allows
        its items to be formatted as a string.
        """
        if len(val) < len(pos):
            raise ValueError,"Not enough values for positions"
        Mark.__init__(self,pos,**kargs)
        self.val = val
        self.color = saneColor(color)
        self.font = gluttext.glutSelectFont(font,size)
        #self.font = getFont(font,size)
        self.leader = str(leader)
        self.gravity = gravity
Example #7
0
    def __init__(self,
                 text,
                 x,
                 y,
                 font='9x15',
                 size=None,
                 gravity=None,
                 color=None,
                 zoom=None,
                 **kargs):
        """Create a text actor"""
        Decoration.__init__(self, x, y, **kargs)
        self.text = str(text)
        self.font = gluttext.glutSelectFont(font, size)

        if gravity is None:
            gravity = 'E'
        self.gravity = gravity
        self.color = saneColor(color)
        self.zoom = zoom
Example #8
0
 def __init__(self,colorlegend,x,y,w,h,ngrid=0,linewidth=None,nlabel=-1,font=None,size=None,dec=2,scale=0,lefttext=False,**kargs):
     """Initialize the ColorLegend."""
     Decoration.__init__(self,x,y,**kargs)
     self.cl = colorlegend
     self.w = int(w)
     self.h = int(h)
     self.ngrid = int(ngrid)
     if self.ngrid < 0:
         self.ngrid = len(self.cl.colors)
         if self.ngrid > 50:
             self.ngrid = 0
     self.linewidth = saneLineWidth(linewidth)
     self.nlabel = int(nlabel)
     if self.nlabel < 0:
         self.nlabel = len(self.cl.colors)
     self.font = gluttext.glutSelectFont(font,size)
     self.dec = dec   # number of decimals
     self.scale = 10 ** scale # scale all numbers with 10**scale
     self.lefttext = lefttext
     self.xgap = 4  # hor. gap between color bar and labels 
     self.ygap = 4  # (min) vert. gap between labels
Example #9
0
 def __init__(self,pos,text,color=None,font='sans',size=18,**kargs):
     Mark.__init__(self,pos,**kargs)
     self.text = text
     self.color = saneColor(color)
     self.font = gluttext.glutSelectFont(font,size)
Example #10
0
 def __init__(self,pos,text,color=None,font='sans',size=18,**kargs):
     Mark.__init__(self,pos,**kargs)
     self.text = text
     self.color = saneColor(color)
     self.font = gluttext.glutSelectFont(font,size)