Shimoku docs
Search…
⌃K

Zero Centered Bar Chart

The zero centered bar chart is used when you want to compare data against a value that can be set as zero, and the data values you have oscillate back and forth this value.

The method to use

The method is shimoku.plt.zero_centered_bar_chart()
It must contain the following input variables:
data: Union[str, DataFrame, List[Dict]]
x: List[str]
y: str
menu_path: str
order: int
And accepts the following input variables as optional:
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]

Examples

1. Default configuration

data_ = [
{'Name': 'a', 'y': 5},
{'Name': 'b', 'y': -7},
{'Name': 'c', 'y': 3},
{'Name': 'd', 'y': -5},
]
shimoku.plt.zero_centered_barchart(
data=data_,
x='Name', y=['y'],
menu_path='zero-centered-bar',
order=0,
)
The result is:
Zero centered bar chart in the default configuration.

2. Title, subtitle, size and padding

It is possible to personalize the title of the chart, its subtitle, its size and add padding. One example could be obtained using:
data_ = [
{'Name': '0h', 'level': 2.6},
{'Name': '3h', 'level': -3},
{'Name': '6h', 'level': 3.2},
{'Name': '9h', 'level': -2.9},
{'Name': '12h', 'level': 3.6},
{'Name': '15h', 'level': -3.4},
]
shimoku.plt.zero_centered_barchart(
data=data_,
x='Name', y=['level'],
menu_path='zero-centered-bar-tide',
order=0, rows_size=2, cols_size=7,
padding='0,0,0,1',
title='Tide level (m)',
subtitle='West Sector',
)
The result is:
Note the space before the component with padding='0,0,0,1', the size with rows_size=2, cols_size=7,title='Tide level (m)', and subtitle='West Sector'. The menu_path='zero-centered-bar-tide' was changed also.
Changing menu_path The menu_path can be modified.
It is possible to use any number of rows.