# Different figure object when using PlotlyJS.make\_subplots()

**URL:** <https://discourse.julialang.org/t/different-figure-object-when-using-plotlyjs-make-subplots/99765>\
**Category:** General Usage\
**Tags:** plotlyjs\
**Created:** [June 2, 2023, 12:09pm UTC](https://discourse.julialang.org/t/different-figure-object-when-using-plotlyjs-make-subplots/99765 "2023-06-02T12:09:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [June 2, 2023, 12:09pm UTC](https://discourse.julialang.org/t/different-figure-object-when-using-plotlyjs-make-subplots/99765/1 "2023-06-02T12:09:55Z")

</div>

Today it gave me a headache to understand the different behaviour of `Plot()` and `make_subplots()` of the package `PlotlyJS`.  
Below an example that shows the difference and might help others:

```julia
using PlotlyJS
# ---
function plot_two_column_five_raws()
    # Here is an example that uses the `rowspan` and `colspan` subplot options
    # to create a custom subplot layout with subplots of mixed sizes.
    _fig_obj = PlotlyJS.make_subplots(
        rows=5, cols=2,
        # column 1 column 2
        specs = [ Spec() Spec(rowspan=2) # raw 1
                  Spec() missing # raw 2
                  Spec(rowspan=2, colspan=2) missing # raw 3
                  missing missing # raw 4
                  Spec() Spec()] # raw 5
    )

    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(1,1)"), row=1, col=1)
    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(1,2)"), row=1, col=2)
    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(2,1)"), row=2, col=1)
    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(3,1)"), row=3, col=1)
    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(5,1)"), row=5, col=1)
    PlotlyJS.add_trace!(_fig_obj, scatter(x=[1, 2], y=[1, 2], name="(5,2)"), row=5, col=2)

    PlotlyJS.relayout!(_fig_obj, height=600, width=600, title_text = "specs examples", ) 
    # PlotlyJS.relayout!(_fig_obj, height=600, width=600, title_text = "specs examples", xaxis_title_text = "x-Axis", )
    # --- figure object created by PlotlyJS.make_subplots() produces a different plot object, that holds the field "plot"
    plt_layout = PlotlyJS.Layout(; xaxis_title_text = "x-Axis", )
    PlotlyJS.relayout!(_fig_obj.plot, plt_layout) # instead the figure object, we modify only the field ".plot"
    return _fig_obj
end

# --- displays output in separate electron-window
plot_two_column_five_raws() 
# --- displays output inside VScode or in a web-browser
plot_two_column_five_raws().plot

```
