rekha.plots.BarPlot¶

class rekha.plots.BarPlot[source]¶

Create a bar plot.

Parameters:
  • orientation (str, default 'v') – Bar orientation (‘v’ for vertical, ‘h’ for horizontal)

  • text_auto (bool, default False) – Whether to automatically add value labels on bars

  • barmode (str, default 'group') – Bar mode (‘group’, ‘stack’, ‘relative’)

  • bar_edge (bool, default False) – Whether to add edges around bars

  • bar_edge_color (str, optional) – Color for bar edges (auto if None)

  • bar_edge_width (float, default 1.0) – Width of bar edges

  • bar_width (float, default 0.8) – Width of bars

  • **kwargs – Additional parameters passed to BasePlot

Methods

add_annotation(text, x, y, **kwargs)

Add annotation to the plot.

get_axes()

Get all axes from the figure.

save(filename[, format, transparent])

Save the plot to file with optimized settings for different use cases.

save_all_formats(base_name, **kwargs)

Save plot in all common formats for different use cases.

show()

Display the plot in the current output (Jupyter notebook, script, etc.).

show_legend()

Manually show the legend with appropriate styling.

update_layout(**kwargs)

Update plot layout - matplotlib style.

__init__(data=None, x=None, y=None, color: str | None = None, orientation: str = 'v', text_auto: bool = False, barmode: str = 'group', bar_edge: bool = False, bar_edge_color: str | None = None, bar_edge_width: float = 1.0, bar_width: float = 0.8, **kwargs)[source]¶

Create a bar plot.

Parameters:
  • orientation (str, default 'v') – Bar orientation (‘v’ for vertical, ‘h’ for horizontal)

  • text_auto (bool, default False) – Whether to automatically add value labels on bars

  • barmode (str, default 'group') – Bar mode (‘group’, ‘stack’, ‘relative’)

  • bar_edge (bool, default False) – Whether to add edges around bars

  • bar_edge_color (str, optional) – Color for bar edges (auto if None)

  • bar_edge_width (float, default 1.0) – Width of bar edges

  • bar_width (float, default 0.8) – Width of bars

  • **kwargs – Additional parameters passed to BasePlot