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


Python RendererBase.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, ipewriter, basename):
        self.width = width
        self.height = height
        self.writer = XMLWriter(ipewriter)
        self.basename = basename

        RendererBase.__init__(self)

        # use same latex as Ipe (default is xelatex)
        rcParams['pgf.texsystem'] = "pdflatex"
        self.latexManager = None
        if rcParams.get("ipe.textsize", False):
            self.latexManager = LatexManagerFactory.get_latex_manager()

        self._start_id = self.writer.start(
            u'ipe',
            version=u"70005",
            creator="matplotlib")
        pre = rcParams.get('ipe.preamble', "")
        if pre != "":
            self.writer.start(u'preamble')
            self.writer.data(pre)
            self.writer.end(indent=False)
        sheet = rcParams.get('ipe.stylesheet', "")
        if sheet != "":
            self.writer.insertSheet(sheet)
        self.writer.start(u'ipestyle', name=u"opacity")

        for i in range(10,100,10):
            self.writer.element(u'opacity', name=u'%02d%%'% i, 
                                value=u'%g'% (i/100.0))
        self.writer.end()
        self.writer.start(u'page')
开发者ID:otfried,项目名称:ipe-tools,代码行数:35,代码来源:backend_ipe.py

示例2: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, svgwriter, basename=None):
        self.width = width
        self.height = height
        self.writer = XMLWriter(svgwriter)

        self._groupd = {}
        if not rcParams["svg.image_inline"]:
            assert basename is not None
            self.basename = basename
            self._imaged = {}
        self._clipd = {}
        self._char_defs = {}
        self._markers = {}
        self._path_collection_id = 0
        self._imaged = {}
        self._hatchd = {}
        self._has_gouraud = False
        self._n_gradients = 0
        self._fonts = {}
        self.mathtext_parser = MathTextParser("SVG")

        RendererBase.__init__(self)
        self._glyph_map = dict()

        svgwriter.write(svgProlog)
        self._start_id = self.writer.start(
            u"svg",
            width=u"%ipt" % width,
            height="%ipt" % height,
            viewBox=u"0 0 %i %i" % (width, height),
            xmlns=u"http://www.w3.org/2000/svg",
            version=u"1.1",
            attrib={u"xmlns:xlink": u"http://www.w3.org/1999/xlink"},
        )
        self._write_default_style()
开发者ID:xiron,项目名称:matplotlib,代码行数:37,代码来源:backend_svg.py

示例3: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
 def __init__(self, dpi, width, height):
     RendererBase.__init__(self)
     self.dpi = dpi
     self.width = width
     self.height = height
     self.gc = GraphicsContextMac()
     self.mathtext_parser = MathTextParser('MacOSX')
开发者ID:astraw,项目名称:matplotlib,代码行数:9,代码来源:backend_macosx.py

示例4: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
 def __init__(self, dpi):
     self.dpi = dpi
     self.gc = GraphicsContextCairo(renderer=self)
     self.text_ctx = cairo.Context(
        cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1))
     self.mathtext_parser = MathTextParser('Cairo')
     RendererBase.__init__(self)
开发者ID:tomflannaghan,项目名称:matplotlib,代码行数:9,代码来源:backend_cairo.py

示例5: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, figure, fh, dummy=False):
        """
        Creates a new PGF renderer that translates any drawing instruction
        into text commands to be interpreted in a latex pgfpicture environment.

        Attributes:
        * figure: Matplotlib figure to initialize height, width and dpi from.
        * fh: File handle for the output of the drawing commands.
        """
        RendererBase.__init__(self)
        self.dpi = figure.dpi
        self.fh = fh
        self.figure = figure
        self.image_counter = 0

        # get LatexManager instance
        self.latexManager = LatexManagerFactory.get_latex_manager()

        if dummy:
            # dummy==True deactivate all methods
            nop = lambda *args, **kwargs: None
            for m in RendererPgf.__dict__.keys():
                if m.startswith("draw_"):
                    self.__dict__[m] = nop
        else:
            # if fh does not belong to a filename, deactivate draw_image
            if not hasattr(fh, 'name') or not os.path.exists(fh.name):
                warnings.warn("streamed pgf-code does not support raster "
                              "graphics, consider using the pgf-to-pdf option",
                              UserWarning)
                self.__dict__["draw_image"] = lambda *args, **kwargs: None
开发者ID:717524640,项目名称:matplotlib,代码行数:33,代码来源:backend_pgf.py

示例6: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
        self.width = width
        self.height = height
        self.writer = XMLWriter(svgwriter)
        self.image_dpi = image_dpi  # the actual dpi we want to rasterize stuff with

        self._groupd = {}
        if not rcParams['svg.image_inline']:
            assert basename is not None
            self.basename = basename
            self._imaged = {}
        self._clipd = OrderedDict()
        self._char_defs = {}
        self._markers = {}
        self._path_collection_id = 0
        self._imaged = {}
        self._hatchd = OrderedDict()
        self._has_gouraud = False
        self._n_gradients = 0
        self._fonts = OrderedDict()
        self.mathtext_parser = MathTextParser('SVG')

        RendererBase.__init__(self)
        self._glyph_map = dict()

        svgwriter.write(svgProlog)
        self._start_id = self.writer.start(
            'svg',
            width='%ipt' % width, height='%ipt' % height,
            viewBox='0 0 %i %i' % (width, height),
            xmlns="http://www.w3.org/2000/svg",
            version="1.1",
            attrib={'xmlns:xlink': "http://www.w3.org/1999/xlink"})
        self._write_default_style()
开发者ID:4over7,项目名称:matplotlib,代码行数:36,代码来源:backend_svg.py

示例7: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, figure, fh, dummy=False):
        """
        Creates a new PGF renderer that translates any drawing instruction
        into text commands to be interpreted in a latex pgfpicture environment.

        Attributes
        ----------
        figure : `matplotlib.figure.Figure`
            Matplotlib figure to initialize height, width and dpi from.
        fh : file-like
            File handle for the output of the drawing commands.
        """

        RendererBase.__init__(self)
        self.dpi = figure.dpi
        self.fh = fh
        self.figure = figure
        self.image_counter = 0

        # get LatexManager instance
        self.latexManager = LatexManager._get_cached_or_new()

        if dummy:
            # dummy==True deactivate all methods
            for m in RendererPgf.__dict__:
                if m.startswith("draw_"):
                    self.__dict__[m] = lambda *args, **kwargs: None
        else:
            # if fh does not belong to a filename, deactivate draw_image
            if not hasattr(fh, 'name') or not os.path.exists(fh.name):
                cbook._warn_external("streamed pgf-code does not support "
                                     "raster graphics, consider using the "
                                     "pgf-to-pdf option", UserWarning)
                self.__dict__["draw_image"] = lambda *args, **kwargs: None
开发者ID:QuLogic,项目名称:matplotlib,代码行数:36,代码来源:backend_pgf.py

示例8: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
 def __init__(self, width, height, dpi, dxfversion):
     RendererBase.__init__(self)
     self.height = height
     self.width = width
     self.dpi = dpi
     self.dxfversion = dxfversion
     self._init_drawing()
开发者ID:dmkent,项目名称:mpldxf,代码行数:9,代码来源:backend_dxf.py

示例9: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, dpi):
        if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
        RendererBase.__init__(self)
        self.texd = maxdict(50)  # a cache of tex image rasters
        self._fontd = maxdict(50)

        self.dpi = dpi
        self.width = width
        self.height = height
        if __debug__: verbose.report('RendererAgg.__init__ width=%s, height=%s'%(width, height), 'debug-annoying')
        self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
        if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done',
                                     'debug-annoying')
        #self.draw_path = self._renderer.draw_path  # see below
        self.draw_markers = self._renderer.draw_markers
        self.draw_path_collection = self._renderer.draw_path_collection
        self.draw_quad_mesh = self._renderer.draw_quad_mesh
        self.draw_image = self._renderer.draw_image
        self.copy_from_bbox = self._renderer.copy_from_bbox
        self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized
        self.mathtext_parser = MathTextParser('Agg')

        self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
        if __debug__: verbose.report('RendererAgg.__init__ done',
                                     'debug-annoying')
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:27,代码来源:backend_agg.py

示例10: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, pswriter, imagedpi=72):
        """
        Although postscript itself is dpi independent, we need to
        imform the image code about a requested dpi to generate high
        res images and them scale them before embeddin them
        """
        RendererBase.__init__(self)
        self.width = width
        self.height = height
        self._pswriter = pswriter
        if rcParams['text.usetex']:
            self.textcnt = 0
            self.psfrag = []
        self.imagedpi = imagedpi
        if rcParams['path.simplify']:
            self.simplify = (width * imagedpi, height * imagedpi)
        else:
            self.simplify = None

        # current renderer state (None=uninitialised)
        self.color = None
        self.linewidth = None
        self.linejoin = None
        self.linecap = None
        self.linedash = None
        self.fontname = None
        self.fontsize = None
        self._hatches = {}
        self.image_magnification = imagedpi/72.0
        self._clip_paths = {}
        self._path_collection_id = 0

        self.used_characters = {}
        self.mathtext_parser = MathTextParser("PS")
开发者ID:zoccolan,项目名称:eyetracker,代码行数:36,代码来源:backend_ps.py

示例11: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, dpi):
        """
        """
        if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
        self.dpi = dpi
        self.gc = GraphicsContextCairo (renderer=self)
        self.text_ctx = cairo.Context (
           cairo.ImageSurface (cairo.FORMAT_ARGB32,1,1))
        self.mathtext_parser = MathTextParser('Cairo')

        RendererBase.__init__(self)
开发者ID:NigelKB,项目名称:matplotlib,代码行数:13,代码来源:backend_cairo.py

示例12: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, figure, fh):
        """
        Creates a new PGF renderer that translates any drawing instruction
        into text commands to be interpreted in a latex pgfpicture environment.

        Attributes:
        * figure: Matplotlib figure to initialize height, width and dpi from.
        * fh: File handle for the output of the drawing commands.
        """
        RendererBase.__init__(self)
        self.dpi = figure.dpi
        self.fh = fh
        self.figure = figure
        self.image_counter = 0

        # get LatexManager instance
        self.latexManager = LatexManagerFactory.get_latex_manager()
开发者ID:BlackEarth,项目名称:portable-python-win32,代码行数:19,代码来源:backend_pgf.py

示例13: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, width, height, dpi):
        if __debug__:
            verbose.report("RendererAgg.__init__", "debug-annoying")
        RendererBase.__init__(self)

        self.dpi = dpi
        self.width = width
        self.height = height
        if __debug__:
            verbose.report("RendererAgg.__init__ width=%s, height=%s" % (width, height), "debug-annoying")
        self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
        self._filter_renderers = []

        if __debug__:
            verbose.report("RendererAgg.__init__ _RendererAgg done", "debug-annoying")

        self._update_methods()
        self.mathtext_parser = MathTextParser("Agg")

        self.bbox = Bbox.from_bounds(0, 0, self.width, self.height)
        if __debug__:
            verbose.report("RendererAgg.__init__ done", "debug-annoying")
开发者ID:Kojoley,项目名称:matplotlib,代码行数:24,代码来源:backend_agg.py

示例14: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
    def __init__(self, figure, fh, dummy=False):
        """
        Creates a new PGF renderer that translates any drawing instruction
        into text commands to be interpreted in a latex pgfpicture environment.

        Attributes:
        * figure: Matplotlib figure to initialize height, width and dpi from.
        * fh: File handle for the output of the drawing commands.
        """
        RendererBase.__init__(self)
        self.dpi = figure.dpi
        self.fh = fh
        self.figure = figure
        self.image_counter = 0

        # get LatexManager instance
        self.latexManager = LatexManagerFactory.get_latex_manager()

        # dummy==True deactivate all methods
        if dummy:
            nop = lambda *args, **kwargs: None
            for m in list(RendererPgf.__dict__.keys()):
                if m.startswith("draw_"):
                    self.__dict__[m] = nop
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:26,代码来源:backend_pgf.py

示例15: __init__

# 需要导入模块: from matplotlib.backend_bases import RendererBase [as 别名]
# 或者: from matplotlib.backend_bases.RendererBase import __init__ [as 别名]
 def __init__(self, w, h, dpi):
     RendererBase.__init__(self)
     self.width = w
     self.height = h
     self.dpi = dpi
     self._draw_stack = []
开发者ID:ChrisBeaumont,项目名称:mplgl,代码行数:8,代码来源:opengl_backend.py


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