Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions lib/matplotlib/backends/backend_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
from matplotlib import _api
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import (
FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase)
FigureCanvasBase,
FigureManagerBase,
GraphicsContextBase,
RendererBase,
)
from matplotlib.figure import Figure


Expand All @@ -48,33 +52,34 @@ class RendererTemplate(RendererBase):
def __init__(self, dpi):
super().__init__()
self.dpi = dpi
self._gc_template = GraphicsContextTemplate()

def draw_path(self, gc, path, transform, rgbFace=None):
pass

# draw_markers is optional, and we get more correct relative
# timings by leaving it out. backend implementers concerned with
# performance will probably want to implement it
# def draw_markers(self, gc, marker_path, marker_trans, path, trans,
# rgbFace=None):
# pass
# def draw_markers(self, gc, marker_path, marker_trans, path, trans,
# rgbFace=None):
# pass

# draw_path_collection is optional, and we get more correct
# relative timings by leaving it out. backend implementers concerned with
# performance will probably want to implement it
# def draw_path_collection(self, gc, master_transform, paths,
# all_transforms, offsets, offset_trans,
# facecolors, edgecolors, linewidths, linestyles,
# antialiaseds):
# pass
# def draw_path_collection(self, gc, master_transform, paths,
# all_transforms, offsets, offset_trans,
# facecolors, edgecolors, linewidths, linestyles,
# antialiaseds):
# pass

# draw_quad_mesh is optional, and we get more correct
# relative timings by leaving it out. backend implementers concerned with
# performance will probably want to implement it
# def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
# coordinates, offsets, offsetTrans, facecolors,
# antialiased, edgecolors):
# pass
# def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
# coordinates, offsets, offsetTrans, facecolors,
# antialiased, edgecolors):
# pass

def draw_image(self, gc, x, y, im):
pass
Expand All @@ -95,7 +100,7 @@ def get_text_width_height_descent(self, s, prop, ismath):

def new_gc(self):
# docstring inherited
return GraphicsContextTemplate()
return self._gc_template

def points_to_pixels(self, points):
# if backend doesn't have dpi, e.g., postscript or svg
Expand Down Expand Up @@ -185,7 +190,7 @@ def draw(self):

# If the file type is not in the base set of filetypes,
# you should add it to the class-scope filetypes dictionary as follows:
filetypes = {**FigureCanvasBase.filetypes, 'foo': 'My magic Foo format'}
filetypes = {**FigureCanvasBase.filetypes, "foo": "My magic Foo format"}

def print_foo(self, filename, **kwargs):
"""
Expand All @@ -200,7 +205,7 @@ def print_foo(self, filename, **kwargs):
self.draw()

def get_default_filetype(self):
return 'foo'
return "foo"


########################################################################
Expand Down