I am trying to create a figure with three subplots. The bottom left subplot is supposed to be a 2D histogram with projections on the top and right sides. The 2D histogram is supposed to be square (hence, the scaleanchor=x3) and I would like to use constrain='domain' to keep the 2D histogram tidy.
With the code shown below, the right projection has a far greater spacing than the top projection (see image). They are supposed to have the same spacings. How can I fix this?
This is my MWE:
import plotly.graph_objs as go from plotly.subplots import make_subplots fig = make_subplots( rows=2, cols=2, shared_xaxes=True, shared_yaxes=True, column_widths=[0.8, 0.2], row_heights=[0.2, 0.8], horizontal_spacing=0.02, vertical_spacing=0.02, ) fig.add_trace(go.Bar(), row=1, col=1) fig.add_trace(go.Bar(), row=2, col=2) fig.add_trace(go.Heatmap(), row=2, col=1) fig.update_layout( xaxis3=dict(range=[0, 1], constrain='domain'), yaxis3=dict(range=[0, 1], constrain='domain', scaleanchor='x3'), ) fig.show() Example output using randomly generated data:
