Projection of 2d density contour on 3D volume axis

Hi all, I’m new to plotly and to this forum. I’m still studying how to use plotly at it’s max capabilities. Sorry for the long post , but I’m trying to merge these plots in a single combined plot.
I really don’t know how to move.

  1. 3D volume plot of two series of data (S) and (R)
# Create the 3D volume plot for 'S' series
fig_s = go.Figure(data=go.Volume(
    x=X.flatten(), y=Y.flatten(), z=Z.flatten(),
    value=density_values_s.flatten(),
    isomin=density_s.min(),
    isomax=density_s.max(),
    opacity=0.1,
    surface_count=25,
    colorscale='PuBu',
    colorbar={"title": 'Density (S)', "showticksuffix": 'none'}  # Combine colorbar properties into a single dictionary
))

# Create the 3D volume plot for 'R' series
fig_r = go.Figure(data=go.Volume(
    x=X.flatten(), y=Y.flatten(), z=Z.flatten(),
    value=density_values_r.flatten(),
    isomin=density_r.min(),
    isomax=density_r.max(),
    opacity=0.1,
    surface_count=25,
    colorscale='Reds',
    colorbar={"title": 'Density (R)', "showticksuffix": 'none', }  # Combine colorbar properties into a single dictionary
))

# Update layout to include column names and set background color and axis tick line color
layout = dict(
    scene=dict(
        xaxis=dict(title='SELF_SO (kcal/mol)', tickcolor='black'),
        yaxis=dict(title='SELF_SA (kcal/mol)', tickcolor='black'),
        zaxis=dict(title='INTER (kcal/mol)', tickcolor='black'),
        bgcolor='white'  # Set background color to white
    ),
    width=800,  # Set width to 800 pixels
    height=800,  # Set height to 800 pixels
    plot_bgcolor='white',  # Set plot background color to white
    paper_bgcolor='white'  # Set paper background color to white
)

fig_s.update_layout(title='3D Volume Scatter Plot (S)', **layout)
fig_r.update_layout(title='3D Volume Scatter Plot (R)', **layout)
# Combine the two subplots into one
combined_fig = go.Figure()

# Add 'S' subplot to the combined figure
combined_fig.add_trace(fig_s.data[0])
combined_fig.update_traces(colorbar = dict(x = -0.15))

# Add 'R' subplot to the combined figure
combined_fig.add_trace(fig_r.data[0])
# Add projections
#combined_fig.add_trace(fig_xz.data[0])
#combined_fig.add_trace(fig_yz.data[0])

# Update layout to include column names and set background color and axis tick line color
layout = dict(
    scene=dict(
        xaxis=dict(title='SELF_SO (kcal/mol)', tickcolor='black'),
        yaxis=dict(title='SELF_SA (kcal/mol)', tickcolor='black'),
        zaxis=dict(title='INTER (kcal/mol)', tickcolor='black'),
        bgcolor='white'  # Set background color to white
    ),
    width=800,  # Set width to 800 pixels
    height=800,  # Set height to 800 pixels
    plot_bgcolor='white',  # Set plot background color to white
    paper_bgcolor='white'  # Set paper background color to white
)


# Update layout and title
combined_fig.update_layout(title='Combined 3D Volume Scatter Plot', **layout)

# Show the combined plot
combined_fig.show()

That gives me this plot

  1. I would like to add 2 density contours on the xz and yz planes, using these plots
# Construct the graph and style it. Further customize your graph by editing this code.
# See Plotly Documentation for help: https://plotly.com/python/plotly-express/
fig_xz = px.density_contour(df_concat, x='SELF_SO', y='INTERENEDIR', color="SA")
# Update layout to include column names and set background color and axis tick line color
layout = dict(
    scene=dict(
        bgcolor='white'  # Set background color to white
    ),
    width=800,  # Set width to 800 pixels
    height=800,  # Set height to 800 pixels
    plot_bgcolor='white',  # Set plot background color to white
    paper_bgcolor='white'  # Set paper background color to white
)
fig_xz.update_xaxes(range=[0,None])
fig_xz.update_layout(title='2D Density Contour Plot', xaxis=dict(title='SELF_SO (kcal/mol)', tickcolor='black'),
        yaxis=dict(title='INTER (kcal/mol)', tickcolor='black'), **layout)
fig_yz = px.density_contour(df_concat, x='SELF_SA', y='INTERENEDIR', color="SA")
layout = dict(
    scene=dict(
        bgcolor='white'  # Set background color to white
    ),
    width=800,  # Set width to 800 pixels
    height=800,  # Set height to 800 pixels
    plot_bgcolor='white',  # Set plot background color to white
    paper_bgcolor='white'  # Set paper background color to white
)
fig_yz.update_xaxes(range=[0,None])
fig_yz.update_layout(title='2D Density Contour Plot', xaxis=dict(title='SELF_SO (kcal/mol)', tickcolor='black'),
        yaxis=dict(title='INTER (kcal/mol)', tickcolor='black'), **layout)
fig_xz.show()
fig_yz.show()

that gives me


I don’t need the series name (legend) in the final combined plot, but I want to keep the blue and the red colors of the R and S series.
I would like “only” to add the density contour on the first 3D plot.
Thanks for your help