Hello,
I am facing issues with zooming into the plot with orthographic projection, it works well with the perspective projection. I used the eye attribute of the 3d scene to do it. Please help me with it. I am also attaching a code snippet.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
app = dash.Dash(__name__)
def create_plot(projection_type):
x = [-12.35, -9.05, -15.05, -13.65, -13.65, -14. - 9.9, -14.5, -10.1, -16.95
, -10.3 - 10.1, -10.55, -17.95, -10.85, -11.85, -11.55, -11.6, -13.2, -14.15
, -13.4, -9.95, -16.35, -10.15, -10.35, -15.05, -10.6, -18.5, -11.85, -11.75
, -11.85, -12.1, -12.15, -11.75, -13.7, -11.8]
y = [4.87, 3.12, 5.92, 5.47, 5.52, 5.67, 3.57, 5.92, 3.67, 6.92, 3.77, 3.77
, 3.92, 7.47, 4.12, 4.52, 4.47, 4.52, 5.27, 5.77, 5.47, 3.57, 6.62, 3.72
, 3.82, 6.27, 3.92, 7.82, -0.83, -0.63, -0.78, -0.68, -0.63, -0.63, 0.12, -0.58
, 0.17, -0.48, -0.48, 0.32, -0.43, 0.37]
z = [3.183, -1.517, -2.017, 0.633, 0.633, 1.033, -0.267, 1.783, 0.033, 0.683
, 0.333, 0.033, 0.633, 2.133, 1.133, -2.017, 2.133, 2.133, -0.067, 1.383
, 4.883, -0.217, -0.117, 0.083, 0.433, 2.633, 0.733, 3.083, 0.483, 0.483
, 0.583, 0.933, 0.933, 0.583, -1.167, 0.583]
plot = go.Scatter3d(
x=x,
y=y,
z=z,
name='xyz pts',
mode='markers',
marker=dict(
size=2.5,
opacity=0.9,
color='#8e001c',
symbol='circle',
),
)
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
), autosize=True, scene=dict(camera=dict(up=dict(x=0, y=0, z=1), center=dict(x=0, y=0, z=0),
eye=dict({'x': 0, 'y': 1, 'z': 0}),
projection=dict(type=projection_type))))
return dcc.Graph(id="my-graph", figure={"data": [plot], "layout": layout},
style={"height": "76vh", "overflow": "hidden", "width": "95vw"})
if __name__ == '__main__':
# app.layout = create_plot(projection_type='perspective')
app.layout = create_plot(projection_type='orthographic')
app.run_server(host='0.0.0.0', debug=True)
Any help would be appreciated, thanks in advance.