PieChart
- class qf_lib.plotting.charts.pie_chart.PieChart(sort_values: Optional[bool] = True, arrows: Optional[bool] = True, autotext_colour: Optional[str] = None, **plot_settings)[source]
Bases:
ChartInitialize the pie chart plotting class.
- Parameters:
sort_values (bool) – If True (default), the data series will be sorted in ascending order before plotting.
arrows (bool) – If True (default), use arrows to point from the pie chart to the labels outside the chart. If False, labels will be placed directly on the pie chart.
autotext_colour (str or None) – Colour to apply to the automatic percentage labels displayed on the pie chart (only applies if arrows=False). If None, the default Matplotlib color is used.
**plot_settings (Dict) – Additional keyword arguments for customizing the plot appearance, such as explode, autopct, textprops, etc.
Methods:
add_decorator(decorator)Adds the new decorator to the chart.
Plots all DataElementDecorators added to a chart.
plot([figsize])Plots the chart.
- add_decorator(decorator: ChartDecorator) None[source]
Adds the new decorator to the chart.
Each decorator must have a unique key that also doesn’t clash with any series keys because both are used for legend label data. If there is already a decorator registered under the specified key, the operation will raise the AssertionError.
Note: In case of PieCharts it is ensured that there exists only a single DataElementDecorator and max one LegendDecorator.
- Parameters:
decorator (ChartDecorator) – decorator to be added
- apply_data_element_decorators(data_element_decorators)[source]
Plots all DataElementDecorators added to a chart. This function should set legend_artist field in each plotted DataElementDecorator (if applicable).
- Parameters:
data_element_decorators (List[DataElementDecorator]) – non-empty list of DataElementDecorators that should be plotted on the chart
- plot(figsize: Tuple[float, float] = None) None[source]
Plots the chart. The underlying figure stays hidden until the show() method is called.
- Parameters:
figsize (Tuple[float, float]) – The figure size to draw the chart at in inches. This is a tuple of (width, height) passed directly to matplotlib’s
plotfunction. The values are expressed in inches.