Zero Centered Bar

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 s.plt.zero_centered_bar()

It must contain the following input variables:

x: str
order: int
data: Union[str, DataFrame, List[Dict]]

And accepts the following input variables as optional:

y: Optional[List[str]]
x_axis_name: Optional[str]
y_axis_name: Optional[str]
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]
show_values: Optional[List[str]]
option_modifications: Optional[Dict]

Examples

1. Default Configuration

data = [
    {'Name': 'a', 'y': 5},
    {'Name': 'b', 'y': -7},
    {'Name': 'c', 'y': 3},
    {'Name': 'd', 'y': -5},
]

s.plt.zero_centered_bar(
    data=data, x='Name', order=0,
)

2. Customization And Context

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},
]

s.plt.zero_centered_bar(
    data=data, x='Name',
    order=0, rows_size=2, cols_size=7,
    padding='0,0,0,1', title='Tide level (m)',
)

Variants

By setting the parameter variant to the following values the appearance of the chart can be changed:

Changing the Menu Path The menu_path can be modified.

Using the Grid

It is possible to use any number of rows.

Last updated