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']}
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