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.