It would be really nice to be able to take two figures created with Plotly Express (or really anything else) and "glue them together" side by side or one above the other, something like fig3 = compose([fig1, fig2, fig3], orientation="h") or something even more powerful.
I love how ggplot patchwork https://github.com/thomasp85/patchwork and Altair https://altair-viz.github.io/user_guide/compound_charts.html do this!
See also Overlaying: #2648
Just spent half an hour looking for a solution to this. Any progress made this week? I need to make some 2x2 subplots with different Y axes. Compose would be very helpful!
This would be a necessary feature, already strongly suggested by the community. The solutions so far are either not native Plotly or depreciates the PX design, for example, by taking only the trace, and leaving the layout out. See: https://github.com/plotly/plotly_express/issues/83#issuecomment-529167965
In the mentioned way, the rug, color, etc, are totally ignored.
If anyone wants to take this on, I'd be happy to review the code :) It's not on our short-term roadmap at the moment, despite how useful it would be!
@nicolaskruchten
Am considering to take up this issue. Running into the following difficulty when trying to figure out a solution on Google Colab:
!pip install plotly==4.12.0
import pandas as pd
import plotly.express as px
from plotly.subplots import make_subplots
pd.options.plotting.backend = 'plotly'
# Ames Housing dataset
df = pd.read_csv('https://github.com/jads-nl/discover-projects/blob/main/ames-housing/AmesHousing.csv?raw=true')
fig = make_subplots(rows=1, cols=2, shared_xaxes=False, shared_yaxes=False)
fig.add_trace(df.SalePrice.hist().data[0], row=1, col=1)
fig.add_trace(df['Year Built'].hist().data[0], row=1, col=2)
The second histogram on the right does not render properly, something goed wrong with the axis and/or default values. I can't see which setting causes this. Could you give a pointer in the right direction perhaps?

Hmm this last one is kind of funny... What's happening here is that both the traces you're extracting with data[0] have bingroup: "x" (where "x" is just an arbitrary string, but it's the PX default) and so the right-hand plot is getting all its data stuck in a single bin! Definitely something we'll have to manage with this composition issue!
If you run fig.update_traces(bingroup=None) after your code that'll clear the groups and each trace will be binned on its own.