lib.charts.*

charts

Provides matplotlib figure that are chart templates

Provides

  • ChartFigure: Main chart class

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

Bases: matplotlib.figure.Figure

Chart figure class with drawing method

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

Parameters

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

_setup_axes(axes_data)[source]

Sets up axes for drawing chart

Parameters

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

_setup_legend(axes_data)[source]

Sets up legend for drawing chart

Parameters

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

_xdate_setter(xdate_format='%Y-%m-%d')[source]

Makes x axis a date axis with auto format

Parameters

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'}
draw_chart()[source]

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>, linewidth=<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

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alpha: scalar or None animated: bool canvas: FigureCanvas clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: bool or dict or None constrained_layout_pads: float, default: :rc:`figure.constrained_layout.w_pad` dpi: float edgecolor: color facecolor: color figheight: float figure: .Figure figwidth: float frameon: bool gid: str in_layout: bool label: object linewidth: number 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: bool or dict with keys “pad”, “w_pad”, “h_pad”, “rect” or None transform: .Transform url: str visible: bool zorder: float

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

Returns svg from matplotlib chart

Parameters
  • figure (Figure) – Matplotlib figure object

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

Return type

str