I am attempting to create a grouped and stacked barplot with plotly express. I have had luck using this approach with a different data set, but this one has the caveat that the column in the dataframe that I am using as the x-axis is (seemingly) numberical. I converted the entire column to strings in pandas, which was the input to plotly, but plotly wants to reformat. I googled it to death and applied the standard fix to layout as such:
However, it is only applying to the first of the subplots. The remainder of the subplots are being converted to floats. Is there a way to apply the layout change such that it implements the change to all auto-generated subplots by plotly express? I am pasting the code I used to generate the stacked/grouped subplots using a tidy dataframe. I attached image, but it’s unclear if it worked. Suffice to say, the first subplot is labeled as a string, but the next subplot is labeled as a float even though I explicitly converted the column to strings.
fig = px.bar(testSpecies, x=‘index’, y=‘RelAb’, barmode=‘stack’, color=‘SpeciesTruncated’, facet_col=‘Patient’)