wolfhece.matplotlib_fig
Module Contents
- wolfhece.matplotlib_fig.sanitize_fmt(fmt)[source]
Sanitizes the given format string for numerical formatting. This function ensures that the format string is in a valid format for floating-point number representation. If the input format string is ‘None’ or an empty string, it defaults to ‘.2f’. Otherwise, it ensures that the format string contains a decimal point and ends with ‘f’ for floating-point representation. If the format string is ‘.f’, it defaults to ‘.2f’.
- Parameters:
fmt (str) – The format string to be sanitized.
- Returns:
A sanitized format string suitable for floating-point number formatting.
- Return type:
str
- wolfhece.matplotlib_fig.MARKERS_MPL = ['None', 'o', 'v', '^', '<', '>', 's', 'p', 'P', '*', 'h', 'H', '+', 'x', 'X', 'D', 'd', '|', '_'][source]
- wolfhece.matplotlib_fig.LINESTYLE_MPL = ['-', '--', '-.', ':', 'solid', 'dashed', 'dashdot', 'dotted', 'None'][source]
- wolfhece.matplotlib_fig.convert_colorname_rgb(color: str) str [source]
Convert a given color name or abbreviation to its corresponding RGB tuple.
- Parameters:
color (str) – The color name or abbreviation to convert. Supported colors are ‘b’/’blue’, ‘g’/’green’, ‘r’/’red’, ‘c’/’cyan’, ‘m’/’magenta’, ‘y’/’yellow’, ‘k’/’black’, ‘w’/’white’, and ‘o’/’orange’.
- Returns:
A tuple representing the RGB values of the color. If the color is not recognized, returns (0, 0, 0) which corresponds to black.
- Return type:
tuple
- wolfhece.matplotlib_fig.convert_color(value: str | tuple) tuple [source]
Convert a hex color to RGB
- class wolfhece.matplotlib_fig.Matplolib_line_properties(line: matplotlib.lines.Line2D = None, ax_props: Matplotlib_ax_properties = None)[source]
- class wolfhece.matplotlib_fig.PRESET_LAYOUTS[source]
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- class wolfhece.matplotlib_fig.Matplotlib_Figure(layout: tuple | list | dict | PRESET_LAYOUTS = None)[source]
Bases:
wx.Frame
Matplotlib Figure with wx Frame
- property fig_properties: Matplotlib_figure_properties[source]
- property _axes_properties: list[Matplotlib_ax_properties][source]
- property cur_ax_properties: Matplotlib_ax_properties[source]
- property cur_line_properties: Matplolib_line_properties[source]
- presets(which: PRESET_LAYOUTS = PRESET_LAYOUTS.DEFAULT)[source]
Presets
- apply_layout(layout: tuple | list | dict | PRESET_LAYOUTS)[source]
Apply the layout
Choose between (subplots, subplot_mosaic, gridspec) according to the type of layout (tuple, list[str], dict)
- fill_grid_with_xy(line: matplotlib.lines.Line2D = None, grid: wolfhece.CpGrid.CpGrid = None, colx: int = 0, coly: int = 1)[source]
- _get_xy_from_grid(grid: wolfhece.CpGrid.CpGrid, colx: int = 0, coly: int = 1)[source]
Get the xy from a grid
- add_line(xy: numpy.ndarray, ax: matplotlib.axes.Axes = None, **kwargs)[source]
Add a plot to the current ax
- class wolfhece.matplotlib_fig.Matplotlib_figure_properties(parent: Matplotlib_Figure = None, fig: matplotlib.figure.Figure = None)[source]