'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.'

def __init__(self, figure, fh, dummy=False):

    RendererBase.__init__(self)
    self.dpi = figure.dpi
    self.fh = fh
    self.figure = figure
    self.image_counter = 0
    self.latexManager = LatexManagerFactory.get_latex_manager()
    if dummy:
        nop = (lambda *args, **kwargs: None)
        for m in RendererPgf.__dict__:
            if m.startswith(u'draw_'):
                self.__dict__[m] = nop
    elif ((not hasattr(fh, u'name')) or (not os.path.exists(fh.name))):
        warnings.warn(u'streamed    pgf-code    does    not    support    raster    graphics,    consider    using    the    pgf-to-pdf    option', UserWarning)
        self.__dict__[u'draw_image'] = (lambda *args, **kwargs: None)
