3D Subplots in Julia

3D Subplots in Plotly


3D Surface Subplots

using PlotlyJS


# Initialize figure with 4 3D subplots
fig = make_subplots(
    rows=2, cols=2,
    specs=fill(Spec(kind="scene"), 2, 2)
)

# Generate data
x = range(-5, stop=80, length=10)
y = range(-5, stop=60, length=10)
xGrid, yGrid = mgrid(y, x)
z = xGrid .^ 3 .+ yGrid .^ 3

# adding surfaces to subplots.
add_trace!(
    fig,
    surface(x=x, y=y, z=z, colorscale="Viridis", showscale=false),
    row=1, col=1)

add_trace!(
    fig,
    surface(x=x, y=y, z=z, colorscale="RdBu", showscale=false),
    row=1, col=2)

add_trace!(
    fig,
    surface(x=x, y=y, z=z, colorscale="YlOrRd", showscale=false),
    row=2, col=1)

add_trace!(
    fig,
    surface(x=x, y=y, z=z, colorscale="YlGnBu", showscale=false),
    row=2, col=2)

relayout!(
    fig,
    title_text="3D subplots with different colorscales",
    height=800,
    width=800
)

fig

Reference

See https://plotly.com/julia/subplots/ for more information regarding subplots!