pytools.viz.matrix.MatrixDrawer#
- class pytools.viz.matrix.MatrixDrawer(style=None)[source]#
Drawer for matrices of numerical values.
Supports the following pre-defined styles:
"matplot"
: matplotlib plot of the matrix using aMatrixMatplotStyle
"matplot%"
: matplotlib plot of matrix with annotations formatted as percentages, using aPercentageMatrixMatplotStyle
"text"
: text representation of the matrix, using aMatrixReportStyle
- Bases
Drawer
[Matrix
[Any
],MatrixStyle
]- Metaclasses
- Parameters
style (
Union
[MatrixStyle
,str
,None
]) – the style to be used for drawing (default:"matplot"
)
Method summary
Render the data using the style associated with this drawer.
Get the default style for this drawer.
Get a mapping of names to style factories for all named styles recognized by this drawer's initializer.
Get a style object by name.
Get all style classes available for this drawer type.
Using the given data object, derive keyword arguments to be passed to the style's
start_drawing()
andfinalize_drawing()
methods.Attribute summary
see
Drawer.style
Definitions
- _draw(data)[source]#
Core drawing method invoked my method
draw()
.Must be implemented by subclasses of
Drawer
.
- draw(data, *, title)#
Render the data using the style associated with this drawer.
Creates a thread-safe lock on this drawer, then calls the following methods in sequence:
Method
start_drawing()
of this drawer’sstyle
attribute, passing the title and additional keyword arguments obtained from this drawer’sget_style_kwargs()
Method
_draw()
, passing along thedata
argumentMethod
finalize_drawing()
of this drawer’sstyle
attribute, passing the keyword arguments obtained from this drawer’sget_style_kwargs()
- Parameters
data (
MatrixDrawer
) – the data to be renderedtitle (
str
) – the title of the resulting chart
- Return type
- classmethod get_default_style()[source]#
Get the default style for this drawer.
- Return type
- Returns
the default style for this drawer
- classmethod get_named_styles()#
Get a mapping of names to style factories for all named styles recognized by this drawer’s initializer.
A factory is a class or function with no mandatory parameters.
- Return type
- classmethod get_style(name)#
Get a style object by name.
- classmethod get_style_classes()[source]#
Get all style classes available for this drawer type.
- Return type
- Returns
an iterable of style classes
- get_style_kwargs(data)[source]#
Using the given data object, derive keyword arguments to be passed to the style’s
start_drawing()
andfinalize_drawing()
methods.
- style: base.MatrixStyle#
see
Drawer.style