Renderer¶
-
class
menpo.visualize.
Renderer
(figure_id, new_figure)[source]¶ Bases:
object
Abstract class for rendering visualizations. Framework specific implementations of these classes are made in order to separate implementation cleanly from the rest of the code.
It is assumed that the renderers follow some form of stateful pattern for rendering to Figures. Therefore, the major interface for rendering involves providing a figure_id or a bool about whether a new figure should be used. If neither are provided then the default state of the rendering engine is assumed to be maintained.
Providing both a
figure_id
andnew_figure == True
is not a valid state.Parameters: - figure_id (object) – A figure id. Could be any valid object that identifies a figure in a given framework (str, int, float, etc.).
- new_figure (bool) – Whether the rendering engine should create a new figure.
Raises: ValueError
– It is not valid to provide a figure id AND request a new figure to be rendered on.-
get_figure
()[source]¶ Abstract method for getting the correct figure to render on. Should also set the correct figure_id for the figure.
Returns: figure (object) – The figure object that the renderer will render on.