BarChart
- class qf_lib.plotting.charts.bar_chart.BarChart(orientation: Orientation, stacked: bool = True, index_translator: Optional[IndexTranslator] = None, thickness: float = 0.8, start_x: Optional[Any] = None, end_x: Optional[Any] = None, upper_y: Optional[float] = None, lower_y: Optional[float] = None, **plot_settings)[source]
Bases:
Chart
Creates a new bar chart with the specified
orientation
.- Parameters:
orientation (Orientation) – The orientation of the bar chart, either Horizontal or Vertical.
stacked (bool) – default: True; if True then bars corresponding to different DataElementDecorators will be stacked. Otherwise bars will be plotted next to each other.
index_translator (IndexTranslator) – the mapper of index coordinates (e.g. you may use labels as index in a pandas series and this translator will ensure that it is plotted correctly)
thickness (float) – how thick should each bar be (expressed in numeric data coordinates system)
start_x (datetime.datetime) – The date where the x-axis should begin.
end_x (datetime.datetime) – The date where the x-axis should end.
upper_y (float) – The upper bound of the y-axis.
lower_y (float) – The lower bound of the y-axis.
plot_settings – Keyword arguments to pass to the
plot
function.
Methods:
Plots all DataElementDecorators added to a chart.
plot
([figsize])Plots the chart.
- apply_data_element_decorators(data_element_decorators: List[DataElementDecorator]) Any [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: Optional[Tuple[float, float]] = 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
plot
function. The values are expressed in inches.