--- jupyter: jupytext: notebook_metadata_filter: all text_representation: extension: .md format_name: markdown format_version: '1.1' jupytext_version: 1.1.6 kernelspec: display_name: Python 3 language: python name: python3 language_info: codemirror_mode: name: ipython version: 3 file_extension: .py mimetype: text/x-python name: python nbconvert_exporter: python pygments_lexer: ipython3 version: 3.7.3 plotly: description: 3D Subplots in Plotly display_as: 3d_charts language: python layout: base name: 3D Subplots order: 4 page_type: example_index permalink: python/3d-subplots/ thumbnail: thumbnail/3d-subplots.jpg --- #### 3D Surface Subplots ```python 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!