plt_ — Plotting#
Warning
Need to review the module and update the documentation.
Module documentation#
matplotlib configuration module for the astropix chip.
- class astropix_analysis.plt_.PlotCard(data: dict = None)[source]#
Small class reperesenting a text card.
This is essentially a dictionary that is capable of plotting itself on a matplotlib figure in the form of a multi-line graphic card.
- Parameters:
data (dict) – A dictionary holding the lines to be displayed in the card.
- KEY_KWARGS = {'color': 'gray', 'ha': 'left', 'size': 'x-small', 'va': 'top'}#
- VALUE_KWARGS = {'color': 'black', 'ha': 'left', 'size': 'small', 'va': 'top'}#
- add_line(key: str, value: float, fmt: str = '%g', units: str = None) None[source]#
Set the value for a given key.
- Parameters:
key (str) – The key, i.e., the explanatory text for a given value.
value (float, optional) – The actual value (if None, a blank line will be added).
fmt (str) – The string format to be used to render the value.
units (str) – The measurement units for the value.
- draw(axes=None, x: float = 0.05, y: float = 0.95, line_spacing: float = 0.075, spacing_ratio: float = 0.75) None[source]#
Draw the card.
- Parameters:
x0 (float) – The absolute coordinates of the top-left corner of the card.
y0 (float) – The absolute coordinates of the top-left corner of the card.
line_spacing (float) – The line spacing in units of the total height of the current axes.
spacing_ratio (float) – The fractional line spacing assigned to the key label.
- astropix_analysis.plt_.last_line_color(default: str = 'black')[source]#
Return the color used to draw the last line
- astropix_analysis.plt_._set_rc_param(key: str, value: Any)[source]#
Set the value for a single matplotlib parameter.
The actual command is encapsulated into a try except block because this is intended to work across different matplotlib versions. If a setting cannot be applied for whatever reason, this will happily move on.
- astropix_analysis.plt_.setup()[source]#
Basic system-wide setup.
The vast majority of the settings are taken verbatim from the matplotlib 2, commit 5285e76: matplotlib/matplotlib
Note that, although this is designed to provide an experience which is as consistent as possible across different matplotlib versions, some of the functionalities are not implemented in older versions, which is why we wrap each parameter setting into a _set_rc_param() function call.