unyt.mpl_interface module¶
Matplotlib offers support for custom classes, such as unyt_array, allowing customization of axis information and unit conversion. In the case of unyt, the axis label is set based on the unyt_array.name and unyt_array.units attributes. It is also possible to convert the plotted units.
This feature is optional and has to be enabled using the matplotlib_support context manager.
-
class
unyt.mpl_interface.
matplotlib_support
(label_style='()')[source]¶ Bases:
object
Context manager for enabling the feature
When used in a with statement, the feature is enabled during the context and then disabled after it exits.
Parameters: label_style (str) – One of the following set,
{'()', '[]', '/'}
. These choices correspond to the following unit labels:'()'
->'(unit)'
'[]'
->'[unit]'
'/'
->'q_x / unit'
-
array_converter
¶
-
label_style
¶ One of the following set,
{'()', '[]', '/'}
. These choices correspond to the following unit labels:'()'
->'(unit)'
'[]'
->'[unit]'
'/'
->'q_x / unit'
Type: str