Black Lives Matter. Please consider donating to Black Girls Code today.

Stacking and scaling bar charts


I’m trying to use some bar charts to plot the amount of different fluids found at some length away from an arbitrary starting point. Here’s a pen to demonstrate the basic concept.

I’ve noticed that the bar chart lengths don’t quite help visualise the relative quantities of each fluid found at a particular distance. I was expecting plotly to make all the other fluids stack on top of the fluid with the greatest volume.

How do I change this bar chart so that the bar charts show relative quantities? Any help would be appreciated.


Quantities relative to what value exactly? The total of all x on your graph, the total at each y coordinate or something else?

Hi etienne, thanks for getting back!

To answer your question, the total at each y coordinate.

Based on your response, I have a feeling this is only possible using relative percentages, which is fine too :slight_smile: . I’d rather explore the option of seeing what plotly is capable of first, before I crunch the numbers.