当前位置: 首页>>代码示例>>Python>>正文


Python Label.fontSize方法代码示例

本文整理汇总了Python中reportlab.graphics.charts.textlabels.Label.fontSize方法的典型用法代码示例。如果您正苦于以下问题:Python Label.fontSize方法的具体用法?Python Label.fontSize怎么用?Python Label.fontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.graphics.charts.textlabels.Label的用法示例。


在下文中一共展示了Label.fontSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addChromosomes

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
def addChromosomes(drawing, chrNames, chrSizes, xmap, ymap, w=0.1*DPI, fillColor=colors.skyblue, strokeColor=colors.skyblue):
    for i,chrom in enumerate(chrNames):
        x = xmap(i+1)
        y = ymap(chrSizes[chrom])
        h = ymap(1)-ymap(chrSizes[chrom])
        
        chromosome = Rect(x,y,w,h, strokeColor=strokeColor, fillColor=fillColor)
        drawing.add(chromosome)
        
        topCap = Wedge(x+0.5*w, y+h, 0.5*w, 0, 180, strokeColor=strokeColor, fillColor=fillColor)
        bottomCap = Wedge(x+0.5*w, y, 0.5*w, 180, 0, strokeColor=strokeColor, fillColor=fillColor)
        drawing.add(topCap)
        drawing.add(bottomCap)
        
        label = Label()
        label.setOrigin(xmap(i+1)+w/2, ymap(0))
        label.boxAnchor = 's'
        label.textAnchor = 'middle'
        label.dx = 0
        label.dy = DPI/10
        label.setText(chrom)
        label.fontSize = 36
        label.fontName = 'Helvetica'
        drawing.add(label)
        
        chrLength = Label()
        chrLength.setOrigin(xmap(i+1)+w/2, ymap(chrSizes[chrom]))
        chrLength.boxAnchor = 'n'
        chrLength.textAnchor = 'middle'
        chrLength.dx = 0
        chrLength.dy = -DPI/10
        chrLength.setText('%iMb' % int(chrSizes[chrom]/1e6))
        chrLength.fontSize = 24
        chrLength.fontName = 'Helvetica'
        drawing.add(chrLength)
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:37,代码来源:drawChroms.py

示例2: _drawLabels

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def _drawLabels(self, Title, xAxis, yAxis):
        self.graphCenterX = self.width/2
        self.graphCenterY = self.height/2
        Label_Xaxis = Label()
        Label_Xaxis.fontSize = 7
        Label_Xaxis.angle = 0
        Label_Xaxis.dx = self.graphCenterX - 50
        Label_Xaxis.dy = 0
        Label_Xaxis.boxAnchor = 's'
        Label_Xaxis.setText(xAxis)
        self.drawing.add(Label_Xaxis)

        Label_Yaxis = Label()
        Label_Yaxis.fontSize = 7
        Label_Yaxis.angle = 90
        Label_Yaxis.boxAnchor = 'n'
        Label_Yaxis.dx = -5
        Label_Yaxis.dy = self.graphCenterY
        Label_Yaxis.setText(yAxis)
        self.drawing.add(Label_Yaxis)

        Label_Graph = Label()
        Label_Graph.fontSize = 10
        Label_Graph.angle = 0
        Label_Graph.boxAnchor = 'n'
        Label_Graph.dx = self.graphCenterX - 50
        Label_Graph.dy = self.height
        Label_Graph.setText(Title)
        self.drawing.add(Label_Graph)
开发者ID:roytest001,项目名称:PythonCode,代码行数:31,代码来源:Qlib.py

示例3: getTalkRect

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def getTalkRect(self, startTime, duration, trackId, text):
        "Return shapes for a specific talk"
        g = Group()
        y_bottom = self.scaleTime(startTime + duration)
        y_top = self.scaleTime(startTime)
        y_height = y_top - y_bottom

        if trackId is None:
            #spans all columns
            x = self._colLeftEdges[1]
            width = self.width - self._colWidths[0]
        else:
            #trackId is 1-based and these arrays have the margin info in column
            #zero, so no need to add 1
            x = self._colLeftEdges[trackId]
            width = self._colWidths[trackId]

        lab = Label()
        lab.setText(text)
        lab.setOrigin(x + 0.5*width, y_bottom+0.5*y_height)
        lab.boxAnchor = 'c'
        lab.width = width
        lab.height = y_height
        lab.fontSize = 6

        r = Rect(x, y_bottom, width, y_height, fillColor=colors.cyan)
        g.add(r)
        g.add(lab)

        #now for a label
        # would expect to color-code and add text
        return g
开发者ID:tschalch,项目名称:pyTray,代码行数:34,代码来源:eventcal.py

示例4: addScale

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
def addScale(drawing, xmap, y, start, end, tickLen=10, dx=3, dy=6,
  textAnchor='middle', boxAnchor='s', fontSize=12,
  strokeWidth=1, strokeColor=colors.black, scale=1.0, format='%ibp'):
    x1 = xmap(start)
    x2 = xmap(end)
    line = Line(x1+dx,y,x2-dx,y,
        strokeWidth=strokeWidth, strokeColor=strokeColor)
    drawing.add(line)
    
    leftTick = Line(x1+dx,y-0.5*tickLen,x1+dx,y+0.5*tickLen,
        strokeWidth=strokeWidth, strokeColor=strokeColor)
    drawing.add(leftTick)
    
    rightTick = Line(x2-dx,y-0.5*tickLen,x2-dx,y+0.5*tickLen,
        strokeWidth=strokeWidth, strokeColor=strokeColor)
    drawing.add(rightTick)
    
    label = Label()
    label.setOrigin(0.5*(x1+x2), y+dy)
    
    distance = float(end-start)/scale
    label.setText(format % (distance/scale))
    label.fontSize = fontSize
    label.textAnchor = textAnchor
    label.boxAnchor = boxAnchor
    drawing.add(label)
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:28,代码来源:__init__.py

示例5: draw

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
 def draw(self):
     # general widget bits
     w = float(self.length)
     h = float(self.height)
     g = shapes.Group()
     
     body = shapes.Polygon(
         [self.x-0.5*w, self.y-0.5*w,
          self.x-0.5*w, self.y+0.5*w,
          self.x+0.5*w, self.y],
         fillColor=self.fillColor,
         strokeColor=self.strokeColor,
         strokeWidth=self.strokeWidth)
     g.add(body)
     
     if self.label:
         b = g.getBounds()
         s = Label()
         s.setText(self.label)
         s.setOrigin(self.x+0.5*w, self.y-h/2+b[3]-b[1]+4)
         s.boxAnchor = self.boxAnchor
         s.textAnchor = self.textAnchor
         s.fontName = 'Helvetica'
         s.fontSize = self.fontSize
         s.angle = self.labelAngle
         g.add(s)
     
     return g
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:30,代码来源:Glyphs.py

示例6: draw

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def draw(self):
        ascent = getFont(self.xValueAxis.labels.fontName).face.ascent
        if ascent == 0:
            ascent = 0.718  # default (from helvetica)
        ascent = ascent * self.xValueAxis.labels.fontSize  # normalize

        # basic LinePlot - does the Axes, Ticks etc
        lp = LinePlot.draw(self)

        xLabel = self.xLabel
        if xLabel:  # Overall label for the X-axis
            xl = Label()
            xl.x = (self.x + self.width) / 2.0
            xl.y = 0
            xl.fontName = self.xValueAxis.labels.fontName
            xl.fontSize = self.xValueAxis.labels.fontSize
            xl.setText(xLabel)
            lp.add(xl)

        yLabel = self.yLabel
        if yLabel:  # Overall label for the Y-axis
            yl = Label()
            yl.angle = 90
            yl.x = 0
            yl.y = self.y + self.height / 2.0
            yl.fontName = self.yValueAxis.labels.fontName
            yl.fontSize = self.yValueAxis.labels.fontSize
            yl.setText(yLabel)
            lp.add(yl)

        # do a bounding box - in the same style as the axes
        if self.outerBorderOn:
            lp.add(
                Rect(
                    self.x,
                    self.y,
                    self.width,
                    self.height,
                    strokeColor=self.outerBorderColor,
                    strokeWidth=self.yValueAxis.strokeWidth,
                    fillColor=None,
                )
            )

        lp.shift(self.leftPadding, self.bottomPadding)

        return lp
开发者ID:eaudeweb,项目名称:naaya,代码行数:49,代码来源:lineplots.py

示例7: title_draw

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
 def title_draw(self, x, y, text):
     chart_title = Label()
     chart_title.x = x
     chart_title.y = y
     chart_title.fontName = 'FreeSansBold'
     chart_title.fontSize = 16
     chart_title.textAnchor = 'middle'
     chart_title.setText(text)
     return chart_title
开发者ID:jink8904,项目名称:mysite,代码行数:11,代码来源:pdf.py

示例8: cn_process

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def cn_process(self, text, x, y, pathnow) :
        pdfmetrics.registerFont(ttfonts.TTFont("font1",'simsun.ttc'))
        title = Label()
        title.fontName = "font1"
        title.fontSize = 14
        title_text = text
        title._text = title_text
        title.x = x
        title.y = y

        return (title)
开发者ID:burningxiong,项目名称:WebZ,代码行数:13,代码来源:autoreport.py

示例9: setDescription

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
 def setDescription(self):
     desc = Label()        
     desc.fontName = 'Helvetica'
     desc.fontSize = 12
     desc.x = 230
     desc.y = 10
     desc._text = self._data_dict.get('description', '')
     desc.maxWidth = 280
     desc.height = 20
     desc.textAnchor ='middle'
     self.add(desc, name='Description')
开发者ID:upfrontsystems,项目名称:tarmii.theme,代码行数:13,代码来源:charts.py

示例10: setTitle

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
 def setTitle(self):
     title = Label()        
     title.fontName = 'Helvetica-Bold'
     title.fontSize = 12
     title.x = 300
     title.y = 335
     title._text = self._data_dict.get('title', '')
     title.maxWidth = 180
     title.height = 20
     title.textAnchor ='middle'
     self.add(title, name='Title')
开发者ID:upfrontsystems,项目名称:tarmii.theme,代码行数:13,代码来源:charts.py

示例11: addLabels

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def addLabels(self,drawing,title=None,xlabel=None,ylabel=None):
        from reportlab.graphics.charts.textlabels import Label
        if not title is None:
            Title = Label()
            Title.fontName = 'Helvetica-Bold'
            Title.fontSize = 7
            Title.x = drawing.width/2
            Title.y = drawing.height-25
            Title._text = title
            Title.maxWidth = 180
            Title.height = 20
            Title.textAnchor ='middle'
            drawing.add(Title)

        if not xlabel is None:
            XLabel = Label()
            XLabel.fontName = 'Helvetica'
            XLabel.fontSize = 7
            XLabel.x = drawing.width/2
            XLabel.y = 10
            XLabel.textAnchor ='middle'
            XLabel.maxWidth = 100
            XLabel.height = 20
            XLabel._text = xlabel
            drawing.add(XLabel)

        if not ylabel is None:
            YLabel = Label()
            YLabel.fontName = 'Helvetica'
            YLabel.fontSize = 7
            YLabel.x = 12
            YLabel.y = drawing.height/2
            YLabel.angle = 90
            YLabel.textAnchor ='middle'
            YLabel.maxWidth = 100
            YLabel.height = 20
            YLabel._text = ylabel
            drawing.add(YLabel)
开发者ID:jhuguetn,项目名称:WAD_Python,代码行数:40,代码来源:reporter.py

示例12: setAxesLabels

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
    def setAxesLabels(self):
        xlabel = Label()
        xlabel.fontName = 'Helvetica'
        xlabel.fontSize = 12
        xlabel.x = 450
        xlabel.y = 40
        xlabel._text = self._data_dict.get('xlabel', '')
        xlabel.maxWidth = 180
        xlabel.height = 20
        xlabel.textAnchor ='middle'
        self.add(xlabel, name='xlabel')

        ylabel = Label()
        ylabel.fontName = 'Helvetica'
        ylabel.fontSize = 12
        ylabel.x = 20
        ylabel.y = 210
        ylabel.angle = 90
        ylabel._text = self._data_dict.get('ylabel', '')
        ylabel.maxWidth = 180
        ylabel.height = 20
        ylabel.textAnchor ='middle'
        self.add(ylabel, name='ylabel')
开发者ID:upfrontsystems,项目名称:tarmii.theme,代码行数:25,代码来源:charts.py

示例13: addLabel

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
def addLabel(drawing, x, y, text, fontName='Helvetica', fontSize=11, dy=0,
             angle=0, boxAnchor='sw', textAnchor='start'):
    """Add a label to the drawing. 
    This interface here is inconsistent in that it requires pixel coords. FIX
    This just sets convenient defaults for Label."""
    label = Label()
    label.setText(text)
    label.setOrigin(x, y)
    label.fontName = fontName
    label.fontSize = fontSize
    label.boxAnchor = boxAnchor
    label.textAnchor = textAnchor
    label.dy = dy
    label.angle = angle
    drawing.add(label)
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:17,代码来源:__init__.py

示例14: addAxis

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
def addAxis(drawing, xmap, y, strokeWidth=1, minorStrokeWidth=0.5, 
  tickDir='down', autoTicks=False, nTicks=20, tickLen=5, fontSize=10, nMinorTicks=80, 
  minorTickLen=2, angle=0, dx=0, dy=-2, textAnchor='middle', boxAnchor=None, 
  scale=1.0, format='%i'):
    """Add a horizontal axis to the drawing.
    
    To do: Round tick positions
    """
    line = Line(xmap.x0, y, xmap.x1, y, strokeWidth=strokeWidth)
    drawing.add(line)
    
    if not boxAnchor:
        if tickDir=='down':
            boxAnchor = 'n'
        else:
            boxAnchor = 's'
    signum = {'up': -1, 'down': 1}[tickDir]
    
    if nTicks>0:
        ticks = tick_generator(xmap.start, xmap.end, n=nTicks, convert=int)
    
    for p in ticks:
        x = xmap(p)
        line = Line(x, y, x, y-signum*tickLen, strokeWidth=strokeWidth)
        drawing.add(line)
        s = Label()
        s.setOrigin(x, y-signum*tickLen)
        s.setText(format % (p/scale))
        s.dx = dx
        s.dy = signum*dy
        s.fontName = 'Helvetica'
        s.fontSize = fontSize
        s.textAnchor = textAnchor
        s.boxAnchor = boxAnchor
        s.angle = angle
        drawing.add(s)
    
    minorticks = tick_generator(xmap.start, xmap.end, n=nMinorTicks, convert=int)
    for p in minorticks:
        x = xmap(p)
        line = Line(x, y, x, y-signum*minorTickLen, strokeWidth=minorStrokeWidth)
        drawing.add(line)
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:44,代码来源:__init__.py

示例15: addAxis

# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import fontSize [as 别名]
def addAxis(drawing, xmap, y, fontSize=8, tickLen=4, minorTickLen=2, 
 nTicks=20, strokeWidth=1, minorStrokeWidth=0.5):
    line = Line(xmap.x0, y, xmap.x1, y, strokeWidth=strokeWidth)
    drawing.add(line)

    ticks = tick_generator(xmap.start, xmap.end, n=nTicks, convert=int)
    for p in ticks:
        x = xmap(p)
        line = Line(x, y, x, y-tickLen, strokeWidth=strokeWidth)
        drawing.add(line)
        s = Label()
        s.setOrigin(x, y-tickLen)
        s.setText(str(p))
        s.fontName = 'Helvetica'
        s.fontSize = fontSize
        s.textAnchor = 'middle'
        s.boxAnchor = 'n'
        drawing.add(s)

    minorticks = tick_generator(xmap.start, xmap.end, n=50, convert=int)
    for p in minorticks:
        x = xmap(p)
        line = Line(x, y, x, y-minorTickLen, strokeWidth=minorStrokeWidth)
        drawing.add(line)
开发者ID:SiriusShiu,项目名称:Mungo,代码行数:26,代码来源:draw_orig.py


注:本文中的reportlab.graphics.charts.textlabels.Label.fontSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。