I wish to plot a 3D scatter plot using plotly.express and wish to fix the X,Y and Z axis at (0,0,0) rather than the minimum value . I tried with matplotlib and changed the ylim and xlim but there is no such options in Plotly.express.
Can someone please help me achieve the above?
I am attaching a sample dataset and other required details.
I need to replace the -200 at each axes with 0 .
Code:
import plotly.express as plt plt.scatter(x="X",y="Y",data_frame=data)
Restricting 3D axes is accomplished by specifying a range of x, y, and z axes for the scene in Layout Change. See the official reference .
import plotly.express as px
fig = px.scatter_3d(df, x='X', y='Y', z='Z')
fig.update_layout(autosize=False,
height=600,
width=600,
scene=dict(
xaxis = dict(nticks=6, range=[0,300],),
yaxis = dict(nticks=6, range=[0,500],),
zaxis = dict(nticks=6, range=[0,500],)
)
)
fig.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.