本文整理汇总了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')
示例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()
示例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')
示例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)
示例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
示例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()
示例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
示例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()
示例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')
示例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")
示例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)
示例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()
示例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")
示例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
示例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 = []