Provides matplotlib figure that are chart templates


  • ChartFigure: Main chart class

class lib.charts.ChartFigure(*attributes)[source]

Bases: Figure

Chart figure class with drawing method

This class is deprecated and exists solely for compatibility with pyspread <1.99.0


attributes (List[dict]) – List of dicts that contain matplotlib attributes The first list element is defining the axes The following list elements are defining plots


Sets up axes for drawing chart


axes_data (dict) – Dicts with keys that match matplotlib axes attributes


Sets up legend for drawing chart


axes_data (dict) – Dicts with keys that match matplotlib axes attributes


Makes x axis a date axis with auto format


xdate_format (str) – Sets date formatting

contour_label_attrs = {'contour_label_colors': 'colors', 'contour_label_fontsize': 'fontsize', 'contour_labels': 'contour_labels'}
contourf_attrs = {'contour_fill': 'contour_fill', 'hatches': 'hatches'}

Plots chart from self.attributes

plot_type_fixed_attrs = {'Sankey': [], 'bar': ['left', 'height'], 'boxplot': ['x'], 'contour': ['X', 'Y', 'Z'], 'contourf': ['X', 'Y', 'Z'], 'hist': ['x'], 'pie': ['x'], 'plot': ['xdata', 'ydata']}
plot_type_xy_mapping = {'Sankey': ['flows', 'orientations'], 'annotate': ['xy', 'xy'], 'bar': ['left', 'height'], 'boxplot': ['x', 'x'], 'contour': ['X', 'Y'], 'contourf': ['X', 'Y', 'Z'], 'hist': ['label', 'x'], 'pie': ['labels', 'x'], 'plot': ['xdata', 'ydata']}
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)

Set multiple properties at once.

Supported properties are


agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None animated: bool canvas: FigureCanvas clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: .Figure figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: unknown linewidth: number mouseover: bool path_effects: .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: .Transform url: str visible: bool zorder: float

lib.charts.fig2x(figure, format)[source]

Returns svg from matplotlib chart

  • figure (Figure) – Matplotlib figure object

  • format (Union[str, Path, IO]) – matplotlib.pyplot.savefig format, normally filename suffix

Return type: