Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Created February 27, 2022 12:31
Show Gist options
  • Save Weiyuan-Lane/604f8d9ef4bb615113dfa38bc3e066d1 to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/604f8d9ef4bb615113dfa38bc3e066d1 to your computer and use it in GitHub Desktop.
Plotty representation
# import chart_studio.plotly as py
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=1, cols=1,
specs=[[{'type': 'surface'}]])
# Generate data
x = np.linspace(0, 10, 10)
y = np.linspace(0, 10, 10)
xGrid, yGrid = np.meshgrid(y, x)
z = xGrid ** 3 + yGrid ** 3
# Default parameters which are used when `layout.scene.camera` is not provided
camera = dict(
up=dict(x=0, y=0, z=1),
center=dict(x=0, y=0, z=0),
eye=dict(x=-1.5, y=-1.5, z=1.5)
)
# adding surfaces to subplots.
fig.add_trace(
go.Surface(x=x, y=y, z=z, colorscale='Viridis', showscale=False),
row=1, col=1)
fig.update_layout(title='Trust = Integrity and Competency',
scene_camera=camera,
scene=dict(
xaxis_title='Integrity',
yaxis_title='Competency',
zaxis_title='Trust'))
fig.show()
py.plot(fig, filename="plotly_scatter", auto_open = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment