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


Python SVGdraw.circle方法代码示例

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


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

示例1: addSeparator

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
 def addSeparator( self ):
     """add separator on circles."""
     if self.mRadius not in self.mSeparators:
         e = SVGdraw.circle( self.mDataMiddleX, self.mDataMiddleY, self.mRadius, fill="none",
                             stroke = "rgb(%i,%i,%i)" % self.mGridColour,
                             stroke_width = self.mGridStrokeWidth )
         self.addWheelElement( e, self.mPlaneGrid )
     self.mSeparators[self.mRadius] = 1
开发者ID:BioinformaticsArchive,项目名称:cgat,代码行数:10,代码来源:SVGDuplicationsWheel.py

示例2: fill

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
   def fill(self,elt):
      pattern=SVGdraw.SVGelement('pattern',attributes=
                                 {"height":"15","width":"15",
                                  "patternUnits":"userSpaceOnUse",
                                  "patternContentUnits":"userSpaceOnUse",
                                  "id":"ermine%04d"%blazon.Ordinary.id})
      blazon.Ordinary.id+=1
      pattern.addElement(self.color1.fill(SVGdraw.rect(x="0",y="0",width="15",height="15")))
      pattern.addElement(self.color2.fill(SVGdraw.SVGelement('path',
                                                             attributes={"d":
                                                        "M1,5 c1,-1 1.5,-4 1.5,-4 c0,0 .5,3 1.5,4 l-1.5,1.5 z"})))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="1.5",cy="2",
                                                         r=".5")))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="2.5",cy="1",
                                                         r=".5")))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="3.5",cy="2",
                                                         r=".5")))
      pattern.addElement(self.color2.fill(SVGdraw.SVGelement('path',
                                            attributes={"d":
                                                        "M8.5,12.5 c1,-1 1.5,-4 1.5,-4 c0,0 .5,3 1.5,4 l-1.5,1.5 z"})))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="9",cy="9.5",
                                                         r=".5")))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="10",cy="8.5",
                                                         r=".5")))
      pattern.addElement(self.color2.fill(SVGdraw.circle(cx="11",cy="9.5",
                                                         r=".5")))

      blazon.Ordinary.defs.append(pattern)
      elt.attributes["fill"]="url(#%s)"%pattern.attributes["id"]
      return elt
开发者ID:ipatrol,项目名称:pyblazon,代码行数:32,代码来源:treatment.py

示例3: getElements

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
    def getElements( self, node_id, x, y ):

        e = []
        colour = self.getColour( node_id, x, y )
        
        if self.mPlotSymbol == "circle":
            e.append( SVGdraw.circle( x + self.mFontSize / 2,
                                      y,
                                      self.mFontSize/2,
                                      stroke = "rgb(%i,%i,%i)" % BLACK,
                                      fill = "rgb(%i,%i,%i)" % colour) )

        elif self.mPlotSymbol == "square":
            e.append( SVGdraw.rect( x, y-self.mFontSize/2,
                                    self.mFontSize,
                                    self.mFontSize,
                                    stroke = "rgb(%i,%i,%i)" % BLACK,
                                    fill = "rgb(%i,%i,%i)" % colour) )
            
        return e
开发者ID:BioinformaticsArchive,项目名称:cgat,代码行数:22,代码来源:SVGTree.py

示例4: addDuplication

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]

#.........这里部分代码省略.........
        ########################################################
        ########################################################
        ########################################################            
        ## draw points 
        ########################################################                    
        link_colour = master_colour
        link_rad_width = self.mLinkRadStrokeWidth
        link_arc_width = self.mLinkArcStrokeWidth
        new_points = {}
        for pos1, pos2, gene, quality, chr in points:

            angle = self.getAngle( (pos1 + pos2) / 2 )
            
            x,y = self.getPosOnArc( angle, self.mRadius )

            try:
                symbol = quality2symbol[quality]
            except KeyError:
                symbol = "rect"

            if quality in quality2mask:
                colour = self.mLinkColourSymbolMasked
                link_colour = self.mLinkColourMasked
                link_rad_width = self.mLinkStrokeWidthMasked
                link_arc_width = self.mLinkStrokeWidthMasked
            else:
                colour = master_colour

            if gene in self.mPreviousPoints:
                continue
            
            new_points[gene] = (x, y, angle, quality, chr)
            
            if symbol == "circle":
                ee = SVGdraw.circle( x, y, self.mLinkSymbolSize,
                                     fill = "rgb(%i,%i,%i)" % colour,
                                     stroke="black",
                                     stroke_width = self.mLinkStrokeWidthSymbol )
            elif symbol == "rect":
                ee =  SVGdraw.rect( x-self.mLinkSymbolSize/2, y-self.mLinkSymbolSize/2,
                                    self.mLinkSymbolSize, self.mLinkSymbolSize,
                                    fill = "rgb(%i,%i,%i)" % colour,
                                    stroke="black",
                                    stroke_width = self.mLinkStrokeWidthSymbol )

            if url:
                e = SVGdraw.link( url % gene )
                e.addElement( ee )
            else:
                e = ee
                
            self.addWheelElement( e )                
            
        ########################################################
        ########################################################
        ########################################################
        ## write all arcs in between old points and new points
        ## cis:   circular arc
        ## trans: radial arc
        ########################################################   

        angles = []
        
        for x1,y1,angle1,quality1,chr1 in new_points.values():

            ## reduce clutter by not writing arc to the same angle
开发者ID:BioinformaticsArchive,项目名称:cgat,代码行数:70,代码来源:SVGDuplicationsWheel.py

示例5: dbgPt

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
def dbgPt(x,y,c='red',d=5):
    debugw.append(SVG.circle(x,y,d, 'white', c, '2'))
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:4,代码来源:svgview.py

示例6: build

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
 def build(self):
     SvgBaseChangeset.build(self)
     (fgc, bgc) = (self._strokecolor, self._fillcolor)
     txc = self._textcolor
     if 'firstchangeset' in self._classes:
         (fgc, bgc) = (bgc, fgc)
     if 'lastchangeset' in self._classes:
         bgc = SvgColor('black')
         txc = SvgColor('white')
         
     widgets = []
     if self._shape == 'circle':
         widgets.append(SVG.circle(self._position[0], self._position[1],
                                   self._radius, bgc, fgc,
                                   self._parent.strokewidth()))
         if self._enhance:
             (x,y) = self._position
             (d,hr) = (self._radius*SQRT3/2, self._radius/2)
             widgets.append(SVG.line(x-d,y-hr,x+d,y-hr, 
                                     fgc, self._parent.strokewidth()))
             widgets.append(SVG.line(x-d,y+hr,x+d,y+hr, 
                                     fgc, self._parent.strokewidth()))
                           
     elif self._shape == 'square':
         r = UNIT/6
         size = self._radius-r
         widgets.append(SVG.rect(self._position[0]-size, 
                                 self._position[1]-size,
                                 2*size, 2*size, bgc, fgc,
                                 self._parent.strokewidth()))
         outline.attributes['rx'] = r
         outline.attributes['ry'] = r        
         
     elif self._shape == 'hexa':
         (x,y) = self._position
         (r,hr) = (self._radius, self._radius/2)
         pd = SVG.pathdata()
         pd.move(x,y-r)
         pd.line(x+r,y-hr)
         pd.line(x+r,y+hr)
         pd.line(x,y+r)
         pd.line(x-r,y+hr)
         pd.line(x-r,y-hr)
         pd.line(x,y-r)
         widgets.append(SVG.path(pd, bgc, fgc, 
                                 self._parent.strokewidth()))
     else:
         raise AssertionError, \
               "unsupported changeset shape (%d)" % self._revision
     title = SVG.text(self._position[0], 
                      self._position[1] + UNIT/6,
                      str(self._revision), 
                      self._parent.fontsize(), self._parent.fontname())
     title.attributes['style'] = 'fill:%s; text-anchor: middle' % txc.rgb()
     widgets.append(title)
     g = SVG.group('grp%d' % self._revision, elements=widgets)
     link = "%s/changeset/%d" % (self._parent.urlbase(), self._revision)
     self._link = SVG.link(link, elements=[g])
     if self._revision:
         self._link.attributes['style'] = \
             'color: %s; background-color: %s' % \
                 (self._strokecolor, self._fillcolor)
         self._link.attributes['id'] = 'rev%d' % self._revision
         self._link.attributes['class'] = ' '.join(self._classes)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:66,代码来源:svgview.py

示例7: svgout

# 需要导入模块: import SVGdraw [as 别名]
# 或者: from SVGdraw import circle [as 别名]
    def svgout(self,stroke_width=0.3,scale=20,circle_radius=0.3,
               startat=None,coloriter=None,crossings=True,circradius=None,circscale=1):
        # if circradius is some positive number, try to draw a circular(!) diagram
        # circscale is how much to scale the y-dimension by (how thick a circle)
#        try:
#            if type(SVGdraw)!=type(__builtins__):
#		raise Exception("SVGdraw not a module?")
#                return None
#        except NameError:
#	    raise Exception("No SVGDraw found")
#            return None

        cols=['#000000', 
              '#800000', '#808000', '#008080', '#000080',
              '#ff2000', '#ffff20', '#20ffff', '#0020ff',
              '#ff0080', '#ff8000', '#8000ff', '#80ff00']
        if circradius:
            sz=(2*self.ymax*circscale+2+2*circradius)
            svg=SVGdraw.svg(width="%dpx"%(sz*scale), height="%dpx"%(sz*scale),
                            viewBox=[-sz+self.xmodulus/2.0, -sz, 2*sz, 2*sz])
            def transform(x,y):
                # Have to flip it over...
                r=self.ymax*circscale+circradius-y*circscale
                theta=2*math.pi*x/self.xmodulus-math.pi
                return [sz/2+r*math.cos(theta), sz/2+r*math.sin(theta)]
        else:
            svg=SVGdraw.svg(width="%dpx"%((self.xmodulus+2)*scale),
                            height="%dpx"%((self.ymax+2)*scale),
                            viewBox=[-1, -1, self.xmodulus+2,
                                      self.ymax+2])
            def transform(x,y):
                return [x,y]
                        
        defs=SVGdraw.defs(id="defs")
        plusmask=SVGdraw.SVGelement("mask",
                                    attributes={"id":"plusmask"})
        minusmask=SVGdraw.SVGelement("mask",
                                     attributes={"id":"minusmask"})
        if circradius:
            sz=1+2*self.ymax*circscale+2*circradius # Whatever, something big.
            r=SVGdraw.rect(x=-sz, y=-sz, width=sz*2,height=sz*2,fill='white')
        else:
            r=SVGdraw.rect(x=-1,y=-1,width=self.xmodulus+2,height=self.ymax+2,
                           fill='white')
        plusmask.addElement(r)
        minusmask.addElement(r)
        defs.addElement(plusmask)
        defs.addElement(minusmask)
        svg.addElement(defs)
        maingroup=SVGdraw.group(id="main")
        # I've come to expect them this way up...
        maingroup.attributes['transform']='scale(1,-1) translate(0,%d)'% \
            (-self.ymax)
        svg.addElement(maingroup)
        # Positive slopes and negative slopes.
        plus=SVGdraw.group(id="plus",mask="url(#plusmask)")
        minus=SVGdraw.group(id="minus",mask="url(#minusmask)")
        maingroup.addElement(plus)
        maingroup.addElement(minus)
        circgroup=SVGdraw.group(id="circgroup")
        maingroup.addElement(circgroup)
        strands=self.strands(self.pivots[0])
        circuit=None
        if coloriter is None:
            if len(strands)>1:
                # Multistranded; color it by strand.
                def multicoloriter():
                    counter=0
                    lastcircuit=None
                    while True:
                        if circuit != lastcircuit:
                            lastcircuit=circuit
                            counter+=1
                        yield cols[counter%len(cols)]
                coloriter=multicoloriter()
            else:
                def singlecoloriter(): # for singlestranders!
                    colcounter=0
                    colordiv=len(self.pivots)/6
                    while True:
                        yield cols[int(colcounter/colordiv)%len(cols)]
                        colcounter+=1
                coloriter=singlecoloriter()

            
        for circuit in strands:
            # If there's a startat parameter, and it appears in this list,
            # slosh the list around so it's first
            if startat and startat in circuit:
                ind=circuit.index(startat)
                circuit=circuit[ind:]+circuit[0:ind]
            for i in range(0,len(circuit)):
                here=circuit[i]
                nxt=circuit[(i+1)%len(circuit)]
                col=coloriter.next()
                if type(col)==int: # let iterator generate indexes
                    col=cols[col%len(cols)]
                if circradius:
                    path=[here,nxt]
                else:
#.........这里部分代码省略.........
开发者ID:clsn,项目名称:THexplorer,代码行数:103,代码来源:knots.py


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