Horizontal Bar Chart
The horizontal bar chart can display the category labels in a natural, easy-to-read manner. If the labels are long they will not overlap.
The method is
shimoku.plt.horizontal_barchart()
It must contain the following input variables:
data: Union[str, DataFrame, List[Dict]]
x: List[str]
y: str
menu_path: str
order: int
Accepts the following input variables as optional:
title: Optional[str]
subtitle: Optional[str]
x_axis_name: Optional[str]
y_axis_name: Optional[str]
filters: Optional[List[str]]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]
And can be personalized with the input variables:
option_modifications: Dict[str, Any]
data_ = [
{'Name': 'd', 'y': 6, 'z': 3},
{'Name': 'c', 'y': 7, 'z': 1},
{'Name': 'b', 'y': 3, 'z': 5},
{'Name': 'a', 'y': 5, 'z': 6},
]
shimoku.plt.horizontal_barchart(
data=data_,
x='Name', y=['y', 'z'],
menu_path='test/horizontal-bar-1',
order=0,
rows_size=2, cols_size=12,
)
The result is:

The horizontal bar chart in the default configuration.
It is possible to personalize the title of the chart, its subtitle, name of each axis, the legend, its size and add padding. One example could be obtained using:
data_ = [
{'Count': 'Ph 1', 'Hours': 6, 'People': 3},
{'Count': 'Ph 2', 'Hours': 7, 'People': 1},
{'Count': 'Ph 3', 'Hours': 3, 'People': 5},
{'Count': 'Ph 4', 'Hours': 5, 'People': 6},
]
shimoku.plt.horizontal_barchart(
data=data_,
x='Count', y=['Hours', 'People'],
menu_path='test/horizontal-bar-2',
order=0,
rows_size=2, cols_size=10,
padding='0,0,0,1',
title='Working Hours and Resources',
subtitle='Resources = Hours x People'
)
The result obtained is:

The horizontal bar chart is fully customized, note the space before the component using
padding='0,0,0,1'
and size using cols_size=10.
It is possible to use any number of rows.
Last modified 8mo ago