Hi @hoatran,
Thank you for much for all you time and help. I have just tried both codes again but for some reason the output is not in the count range as yours in both instances I am seeing values of max 1. As you are able to produce the charts, perhaps the issue could be related to the environment.
Code 1
ax = pd.pivot_table(ElectricCarData,values=‘Model’, index=[‘Brand’,‘RapidCharge’], aggfunc=‘count’).reset_index()
fig = px.bar(ax, x=“Brand”, y=“Model”, facet_row=“RapidCharge”, color=‘RapidCharge’)
fig.for_each_annotation(lambda a: a.update(text=a.text.split(“=”)[1]))
fig.show()
Output 1
code 2
ax = pd.pivot_table(ElectricCarData,values=“Model”, index=[“Brand”,“RapidCharge”], aggfunc=“count”).reset_index()
ax1 = ax[ax[“RapidCharge”] == “Rapid charging possible”]
ax2 = ax[ax[“RapidCharge”] == “Rapid charging not possible”]
fig = make_subplots(
rows=1, cols=2,
subplot_titles=(“Plot 1”, “Plot 2”))
fig.add_trace(go.Bar(x=ax1[‘Brand’], y=ax1[‘Model’]),
row=1, col=1)
fig.add_trace(go.Bar(x=ax2[‘Brand’], y=ax2[‘Model’]),
row=1, col=2)
fig.update_layout(height=500, width=700,
title_text=“Multiple Subplots with Titles”)
output 2