CARVIEW |
Select Language
HTTP/2 200
accept-ranges: bytes
access-control-allow-origin: *
age: 0
cache-control: max-age=600
content-encoding: gzip
content-type: text/html; charset=utf-8
date: Sun, 12 Oct 2025 18:06:05 GMT
etag: W/"68e952e4-db11"
expires: Sun, 12 Oct 2025 18:16:05 GMT
last-modified: Fri, 10 Oct 2025 18:39:32 GMT
server: Vercel
strict-transport-security: max-age=63072000
vary: Accept-Encoding
via: 1.1 varnish
x-cache: MISS
x-cache-hits: 0
x-fastly-request-id: 528c4b9f353ba87bd1c2fc3af5be21674d6f4b67
x-github-request-id: 5FE8:54038:167977:1B5E71:68EBEE0D
x-proxy-cache: MISS
x-robots-tag: index
x-served-by: cache-bom-vanm7210054-BOM
x-timer: S1760292366.611487,VS0,VE290
x-vercel-cache: MISS
x-vercel-id: bom1::krvp9-1760292365600-3e104f12654d
content-length: 12370
3d subplots in Python
3D Subplots in Python
3D Subplots in Plotly
Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.
3D Surface Subplots¶
In [1]:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
# Initialize figure with 4 3D subplots
fig = make_subplots(
rows=2, cols=2,
specs=[[{'type': 'surface'}, {'type': 'surface'}],
[{'type': 'surface'}, {'type': 'surface'}]])
# Generate data
x = np.linspace(-5, 80, 10)
y = np.linspace(-5, 60, 10)
xGrid, yGrid = np.meshgrid(y, x)
z = xGrid ** 3 + yGrid ** 3
# adding surfaces to subplots.
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale='Viridis', showscale=False),
row=1, col=1)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale='RdBu', showscale=False),
row=1, col=2)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale='YlOrRd', showscale=False),
row=2, col=1)
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale='YlGnBu', showscale=False),
row=2, col=2)
fig.update_layout(
title_text='3D subplots with different colorscales',
height=800,
width=800
)
fig.show()
Reference¶
See https://plotly.com/python/subplots/ for more information regarding subplots!
What About Dash?¶
Dash is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library.
Learn about how to install Dash at https://dash.plot.ly/installation.
Everywhere in this page that you see fig.show()
, you can display the same figure in a Dash application by passing it to the figure
argument of the Graph
component from the built-in dash_core_components
package like this:
import plotly.graph_objects as go # or plotly.express as px
fig = go.Figure() # or any Plotly Express function e.g. px.bar(...)
# fig.add_trace( ... )
# fig.update_layout( ... )
from dash import Dash, dcc, html
app = Dash()
app.layout = html.Div([
dcc.Graph(figure=fig)
])
app.run(debug=True, use_reloader=False) # Turn off reloader if inside Jupyter
