# Two subfigures with PlotlyJS.jl

**URL:** <https://discourse.julialang.org/t/two-subfigures-with-plotlyjs-jl/99666>\
**Category:** Specific Domains\
**Tags:** question, plotting, visualization\
**Created:** [May 31, 2023, 11:21am UTC](https://discourse.julialang.org/t/two-subfigures-with-plotlyjs-jl/99666 "2023-05-31T11:21:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ga72kud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ga72kud/32/32180_2.png) [@ga72kud](https://discourse.julialang.org/u/ga72kud)\
**Post date:** [May 31, 2023, 11:21am UTC](https://discourse.julialang.org/t/two-subfigures-with-plotlyjs-jl/99666/1 "2023-05-31T11:21:13Z")

</div>

I am using the great PlotlyJS package for map visualization. I want to have two subfigures with USA and Europe map. I can the following code, but the subfigures do not scale adequate

```julia
using PlotlyJS, DataFrames
using XLSX
using Plots
#plotlyjs()
df = DataFrame(XLSX.readtable("myfile.xlsx", "mysheet"))

function maps1(df)
    marker = attr(size=df[!, :size],
                  color=df[!, :color],
                  cmin=0,
                  cmax=60,
                  colorscale="Greens",
                  colorbar=attr(title="Some rate",
                                ticksuffix="%",
                                showticksuffix="last"),
                  line_color="black")
    trace_europe = scattergeo(;mode="markers", lat=df[!, :lat], lon=df[!, :lon],
                        marker=marker, name="Europe Data")
    trace_asia = scattergeo(;mode="markers", lat=df[!, :lat], lon=df[!, :lon],
                        marker=marker, name="Asia Data")
    layout_europe = Layout(geo_scope="europe", geo_resolution=50, width=500, height=550,
                    margin=attr(l=0, r=0, t=10, b=0))
    plot_europe=PlotlyJS.plot(trace_europe, layout_europe)
    layout_asia = Layout(geo_scope="asia", geo_resolution=50, width=500, height=550,
                    margin=attr(l=0, r=0, t=10, b=0))
    plot_asia=PlotlyJS.plot(trace_asia, layout_asia)
    p = [plot_europe plot_asia]
    display(p)
    PlotlyJS.savefig(p,"file.png")
    
end
maps1(df)

```

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [May 31, 2023, 4:45pm UTC](https://discourse.julialang.org/t/two-subfigures-with-plotlyjs-jl/99666/2 "2023-05-31T16:45:35Z")

</div>

See this answer [https://discourse.julialang.org/t/plotlyjs-subplots-and-individual-layouts/87740/2](https://discourse.julialang.org/t/plotlyjs-subplots-and-individual-layouts/87740/2) to a question related to subplots.  
More precisely, in your case define:

```julia
plt=make_subplots(rows=2, cols=1, 
                  specs=reshape([Spec(kind="geo")
                                 Spec(kind="geo")], 2,1))

```

and add traces to each subplot, as in the example from the above link.  
Also with the latest PlotplyJS version, the colorscale in marker definition  
should be `colorscale=colors.Greens`.
