Using plotly 5.22.0, I am following the answer here to include plotly express figures as subplots. When combining px.histogram figures with string-values, the x-axis ticks display correctly for the first subplot, but are missing for all others.
import pandas as pd
import plotly.express as px
import plotly.subplots as sp
df = pd.DataFrame([['a','d'],['a','f'],['c','f']],columns=['A','B'])
fig1 = px.histogram(df,x='A')
fig2 = px.histogram(df,x='B')
fig1_traces = []
fig2_traces = []
for trace in range(len(fig1["data"])):
fig1_traces.append(fig1["data"][trace])
for trace in range(len(fig2["data"])):
fig2_traces.append(fig2["data"][trace])
this_figure = sp.make_subplots(rows=1, cols=2)
for traces in fig1_traces:
this_figure.append_trace(traces, row=1, col=1)
for traces in fig2_traces:
this_figure.append_trace(traces, row=1, col=2)
this_figure.show()
How can I get the x-ticks displaying correctly for additional subplots?