當前位置: 首頁>>代碼示例>>Python>>正文


Python Path.hatch方法代碼示例

本文整理匯總了Python中matplotlib.path.Path.hatch方法的典型用法代碼示例。如果您正苦於以下問題:Python Path.hatch方法的具體用法?Python Path.hatch怎麽用?Python Path.hatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.path.Path的用法示例。


在下文中一共展示了Path.hatch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: hatchPattern

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def hatchPattern(self, hatch_style):
        # The colors may come in as numpy arrays, which aren't hashable
        if hatch_style is not None:
            face, edge, hatch = hatch_style
            if face is not None:
                face = tuple(face)
            if edge is not None:
                edge = tuple(edge)
            hatch_style = (face, edge, hatch)

        pattern = self.hatchPatterns.get(hatch_style, None)
        if pattern is not None:
            return pattern

        name = Name('H%d' % self.nextHatch)
        self.nextHatch += 1
        self.hatchPatterns[hatch_style] = name
        return name 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:backend_pdf.py

示例2: __init__

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def __init__(self):
        self._alpha = 1.0
        self._forced_alpha = False  # if True, _alpha overrides A from RGBA
        self._antialiased = 1  # use 0,1 not True, False for extension code
        self._capstyle = 'butt'
        self._cliprect = None
        self._clippath = None
        self._dashes = None, None
        self._joinstyle = 'round'
        self._linestyle = 'solid'
        self._linewidth = 1
        self._rgb = (0.0, 0.0, 0.0, 1.0)
        self._hatch = None
        self._hatch_color = colors.to_rgba(rcParams['hatch.color'])
        self._hatch_linewidth = rcParams['hatch.linewidth']
        self._url = None
        self._gid = None
        self._snap = None
        self._sketch = None 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:21,代碼來源:backend_bases.py

示例3: hatchPattern

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def hatchPattern(self, hatch_style):
        # The colors may come in as numpy arrays, which aren't hashable
        if hatch_style is not None:
            edge, face, hatch = hatch_style
            if edge is not None:
                edge = tuple(edge)
            if face is not None:
                face = tuple(face)
            hatch_style = (edge, face, hatch)

        pattern = self.hatchPatterns.get(hatch_style, None)
        if pattern is not None:
            return pattern

        name = Name('H%d' % self.nextHatch)
        self.nextHatch += 1
        self.hatchPatterns[hatch_style] = name
        return name 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:20,代碼來源:backend_pdf.py

示例4: set_hatch

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def set_hatch(self, hatch):
        """
        Sets the hatch style for filling
        """
        self._hatch = hatch 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:backend_bases.py

示例5: get_hatch

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch(self):
        """
        Gets the current hatch style
        """
        return self._hatch 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:backend_bases.py

示例6: get_hatch_path

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch_path(self, density=6.0):
        """
        Returns a Path for the current hatch.
        """
        if self._hatch is None:
            return None
        return Path.hatch(self._hatch, density) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:9,代碼來源:backend_bases.py

示例7: writeHatches

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def writeHatches(self):
        hatchDict = dict()
        sidelen = 72.0
        for hatch_style, name in self.hatchPatterns.iteritems():
            ob = self.reserveObject('hatch pattern')
            hatchDict[name] = ob
            res = { 'Procsets':
                    [ Name(x) for x in "PDF Text ImageB ImageC ImageI".split() ] }
            self.beginStream(
                ob.id, None,
                { 'Type': Name('Pattern'),
                  'PatternType': 1, 'PaintType': 1, 'TilingType': 1,
                  'BBox': [0, 0, sidelen, sidelen],
                  'XStep': sidelen, 'YStep': sidelen,
                  'Resources': res })

            # lst is a tuple of stroke color, fill color,
            # number of - lines, number of / lines,
            # number of | lines, number of \ lines
            rgb = hatch_style[0]
            self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_stroke)
            if hatch_style[1] is not None:
                rgb = hatch_style[1]
                self.output(rgb[0], rgb[1], rgb[2], Op.setrgb_nonstroke,
                            0, 0, sidelen, sidelen, Op.rectangle,
                            Op.fill)

            self.output(0.1, Op.setlinewidth)

            # TODO: We could make this dpi-dependent, but that would be
            # an API change
            self.output(*self.pathOperations(
                    Path.hatch(hatch_style[2]),
                    Affine2D().scale(sidelen),
                    simplify=False))
            self.output(Op.stroke)

            self.endStream()
        self.writeObject(self.hatchObject, hatchDict) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:41,代碼來源:backend_pdf.py

示例8: create_hatch

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def create_hatch(self, hatch):
        sidelen = 72
        if hatch in self._hatches:
            return self._hatches[hatch]
        name = 'H%d' % len(self._hatches)
        self._pswriter.write("""\
  << /PatternType 1
     /PaintType 2
     /TilingType 2
     /BBox[0 0 %(sidelen)d %(sidelen)d]
     /XStep %(sidelen)d
     /YStep %(sidelen)d

     /PaintProc {
        pop
        0 setlinewidth
""" % locals())
        self._pswriter.write(
            self._convert_path(Path.hatch(hatch), Affine2D().scale(72.0),
                               simplify=False))
        self._pswriter.write("""\
          stroke
     } bind
   >>
   matrix
   makepattern
   /%(name)s exch def
""" % locals())
        self._hatches[hatch] = name
        return name 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:32,代碼來源:backend_ps.py

示例9: set_hatch

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def set_hatch(self, hatch):
        """Set the hatch style (for fills)."""
        self._hatch = hatch 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:5,代碼來源:backend_bases.py

示例10: get_hatch

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch(self):
        """Get the current hatch style."""
        return self._hatch 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:5,代碼來源:backend_bases.py

示例11: get_hatch_path

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch_path(self, density=6.0):
        """Return a `Path` for the current hatch."""
        hatch = self.get_hatch()
        if hatch is None:
            return None
        return Path.hatch(hatch, density) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:8,代碼來源:backend_bases.py

示例12: get_hatch_color

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch_color(self):
        """Get the hatch color."""
        return self._hatch_color 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:5,代碼來源:backend_bases.py

示例13: get_hatch_linewidth

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def get_hatch_linewidth(self):
        """Get the hatch linewidth."""
        return self._hatch_linewidth 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:5,代碼來源:backend_bases.py

示例14: writeHatches

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def writeHatches(self):
        hatchDict = dict()
        sidelen = 72.0
        for hatch_style, name in self.hatchPatterns.items():
            ob = self.reserveObject('hatch pattern')
            hatchDict[name] = ob
            res = {'Procsets':
                   [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]}
            self.beginStream(
                ob.id, None,
                {'Type': Name('Pattern'),
                 'PatternType': 1, 'PaintType': 1, 'TilingType': 1,
                 'BBox': [0, 0, sidelen, sidelen],
                 'XStep': sidelen, 'YStep': sidelen,
                 'Resources': res,
                 # Change origin to match Agg at top-left.
                 'Matrix': [1, 0, 0, 1, 0, self.height * 72]})

            stroke_rgb, fill_rgb, path = hatch_style
            self.output(stroke_rgb[0], stroke_rgb[1], stroke_rgb[2],
                        Op.setrgb_stroke)
            if fill_rgb is not None:
                self.output(fill_rgb[0], fill_rgb[1], fill_rgb[2],
                            Op.setrgb_nonstroke,
                            0, 0, sidelen, sidelen, Op.rectangle,
                            Op.fill)

            self.output(rcParams['hatch.linewidth'], Op.setlinewidth)

            self.output(*self.pathOperations(
                Path.hatch(path),
                Affine2D().scale(sidelen),
                simplify=False))
            self.output(Op.fill_stroke)

            self.endStream()
        self.writeObject(self.hatchObject, hatchDict) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:39,代碼來源:backend_pdf.py

示例15: hatch_cmd

# 需要導入模塊: from matplotlib.path import Path [as 別名]
# 或者: from matplotlib.path.Path import hatch [as 別名]
def hatch_cmd(self, hatch, hatch_color):
        if not hatch:
            if self._fillcolor is not None:
                return self.fillcolor_cmd(self._fillcolor)
            else:
                return [Name('DeviceRGB'), Op.setcolorspace_nonstroke]
        else:
            hatch_style = (hatch_color, self._fillcolor, hatch)
            name = self.file.hatchPattern(hatch_style)
            return [Name('Pattern'), Op.setcolorspace_nonstroke,
                    name, Op.setcolor_nonstroke] 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:13,代碼來源:backend_pdf.py


注:本文中的matplotlib.path.Path.hatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。