X-ticks for histograms missing from subplots

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?

Graph configuration data can be viewed in print(this_figure.data). The bin group was on the x-axis, so if you set it to the x2 axis, it will be displayed.

for traces in fig1_traces:
    this_figure.add_trace(traces, row=1, col=1)
for traces in fig2_traces:
    this_figure.add_trace(traces, row=1, col=2)

this_figure.update_traces(bingroup='x2', row=1, col=2) # update

this_figure.show()

That’s awesome, thanks for the solution! Is this expected behaviour or a bug? I didn’t see similar behaviour if the histogram had numeric x-axis.

Since you are creating a histogram for each and reusing it, the bin group will only be the x-axis.
I do not know why the x-axis is not impaired if it is numeric.

I see. Thanks again for your help!