Multiple histograms with different classes / x-axis

I have data about the identified bacteria in our lab that I want to visualize. I want to show on three different levels of identification (Species, genus and family) how many of a group there are. Iā€™m doing this using facet because I want to assign colors to the ā€œorigin of samplesā€ (AMB).

I have a dataframe with a column ā€œSGFā€ containing the classifications at different levels mixed through each other, a column ā€œAMBā€ and a column ā€œLevelā€. Iā€™m calling my histogram like this:

fig = plx.histogram(Jdf, x="SGF", color="AMB_type", barmode = "stack", facet_col="Level")

After some tuning of my axes and labels, this gives the following figure.

The empty pieces in each plot are from data that should only be shown in one of the other plots. All levels are shown on all axes. How do I get my different axes only show the x-data linked to a certain level? I have tried this but then I just get an empty figure:

fig.update_xaxes(matches = None)

If you believe it cannot be done this way, I also have my original data where the different levels (species, genus, family) are in different columns. I just couldnā€™t figure out how to combine their separate counts so that the color parameter is shared.

Hi @XanderC137 welcome to the forums.

I think this topic might be related.