I'm using plotly express and the gapminder dataset to plot a bar chart, to which I have some similar dataset. I found the instructions in their official website and here is the code and figure:
import plotly.express as px
gapminder = px.data.gapminder()
fig = px.bar(gapminder, x="continent", y="pop", color="continent",
animation_frame="year", animation_group="country", range_y=[0,4000000000])
fig.show()
However, I also wish to add another dataset for each bar as a comparison. Ideally, I wish to have a result as below:
For the result in each bar, I have a dataset as the "total number". For example, for the first bar, the "yellow one" is the total number and "blue one" is the targeted number, just I wish to combine them in the same figure. But the example only shows a single dataset. I wonder how I can change the parameter of "y" to include the two datasets?