I have a table with products and categories. I want to create subplots for each category.
import plotly.express as px
import pandas as pd
data = {'Category':["Toys","Toys","Toys","Toys","Food","Food","Food","Food","Food","Food","Food","Food","Furniture","Furniture","Furniture"],
'Product':["AA","BB","CC","DD","SSS","DDD","FFF","RRR","EEE","WWW","LLLLL","PPPPPP","LPO","NHY","MKO"],
'QTY':[100,200,300,50,20,800,300,450,150,320,400,1000,150,900,1150]}
df = pd.DataFrame(data)
fig = px.bar(df, x="Product", y="QTY", barmode="group",facet_col="Category")
fig.show()
But I get the same x and y axes in the charts. How can I set for each plot a coordinate axis for its data? That is, the x-axis will have only products that belong to the same category. The y-axis maximum value will be equal to the maximum quantity in each categoryβ¦