✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Looking for style of chart

I’m looking for a particular style of chart - presuming I’m using the right style. I don’t even know if this is the best way to show this type of data - I’m just getting my head around it now.

I have a list of ~40 file shares, each of which has a different capacity (total available in GB) and usage (total used in GB).

The usage will always be less than the capacity.

Is there a way to have a style of stacked bar chart that will show the share on X, and on Y we have the usage in front of the capacity?

I’m looking for something that will roughly look like this very quick mock up I did:

df = pd.DataFrame([{'share': '/nfs/share1', 'used': '40', 'capacity':'100'},
{'share': '/nfs/share2', 'used': '130', 'capacity':'140'}
{'share': '/nfs/share3', 'used': '10', 'capacity':'50'}])

Screenshot from 2020-08-31 14-00-45

Seems I’ve worked it out myself - had to go spelunking into the API docs.

barmode='overlay' doesn’t seem to be mentioned anywhere else, and it’s not clear from the docs that order is important - they will be rendered in order of listing. In the below it looks correct, my first attempt with “Usage” on the first line hid that data behind the “Capacity” data.

fig2 = go.Figure(data =[
    go.Bar(name='Capacity', x=volume_data.share, y=volume_data.capacity),
    go.Bar(name='Usage', x=volume_data.share, y=volume_data.usage),
fig2.update_layout(barmode='overlay', xaxis_tickangle=45)