Search code examples
pythonplotlyplotly-python

plotly subplots: is it possible to have one subplots occupy multiple columns or rows


I am trying to have 3 plots on one figure using plotly subplots. Naturally, I could do just 3 rows but I am trying to have first two figures side-by-side and another being stretched out. Overall I am trying to get a layout on the picture (that I made with paint): enter image description here Is it possible and if yes how can I achieve this ?


Solution

  • From the documentation examples, using specs to define multi col span:

    from plotly.subplots import make_subplots
    import plotly.graph_objects as go
    
    fig = make_subplots(
        rows=2, cols=2,
        specs=[[{}, {}],
               [{"colspan": 2}, None]],
        subplot_titles=("First Subplot","Second Subplot", "Third Subplot"))