Subplots + Independent layouts

I would like to store / join, multiples subplots layouts dynamically in a data array and layout array and then create a dynamic big graph with my multiples subplots.

My subplots can be mixed type or not.

I saw this mixed example here:

And this other example here:

But in these examples I have to create a single layout object and write manually the “scene1”, “scene2”, “scene3” layout properties…

How can I “concatenate” multiples data and layout objects to create a big dynamic plot with multiples subplots?

One figure can only have a single layout object, however layout can have multiple axes. Can you define the axes in a loop for example?

Also, are you using plotly with Python or Javascript ? With Python we have the fig.update_xaxes and fig.update_yaxes methods which are convenient for updating all axes at the same time.

Hi Emmanuelle, thanks for your quick response.

So, I’m using Javascript.
Yes, I can create a loop and fill the layout object with multiple layouts data.

Could you please give a simple write-hand example about how this final layout object will be?

In my project, each layout object is like this:

let layout = {
        title: "My title A"
        scene: {
            xaxis: {
                title: "X"
                titlefont: {
                    size: 25,
                }
            },
            yaxis: {
                title: "Y"
                titlefont: {
                    size: 25,
                }
            },
            zaxis: {
                title: "Z"
                titlefont: {
                    size: 25,
                }
            }
        }
    }

But I tried to some thing like:
let final_layout = [layout1, layout2, layout3, ...];

But it doesn’t work…could you help me?

You cannot concatenate layout objects since a figure has a single layout, however you can retrieve the scene object from each individual layout and populate the layout of the final figure with these scene objects, incrementing their names (‘scene’, ‘scene2’, ‘scene3’). I’m not very familiar with Javascript so it would be hard for me to write a full-fledged example but if you share a codepen with what you’re trying to do I can try to help you modify it.

Thank you for the informations Emmanuelle!

I follow your sugestion about CodePen.
Here is the link: https://codepen.io/nyckmaia/pen/ZEEqxMX?editors=1010

In this example, I put 4 traces to be ploted together:
-> Two cartesian plots
-> Two 3D plots

I would like to put these two cartesian above these two 3D plots, like: Two above and two below.

How can I do that using this source-code?
Could I remove the scene object property?

Thank you again,

Emmanuelle,
I am having the same issue, but with Python. I have 3 different plots (the 3 of them a of different types) i created the figure: fig = make_subplots(
rows=1, cols=3, subplot_titles=(“plot1”, “plot2”, “plot3”)
)
how can i have different layouts or each plot. for example different y range for plot1 and plot 2.
How do i retrieve the scene object in python?