Data visualization lab

Program 9

Write a Python program to draw 3D Plots using Plotly Libraries.



import numpy as np
import plotly.graph_objects as go

# Create grid data
X = np.linspace(-5, 5, 50)
Y = np.linspace(-5, 5, 50)
X, Y = np.meshgrid(X, Y)
Z = np.cos(np.sqrt(X**2 + Y**2))

# Create 3D Surface Plot
fig = go.Figure(data=[go.Surface(z=Z, x=X, y=Y, colorscale="Cividis")])
fig.update_layout(title="3D Surface Plot", scene=dict(xaxis_title="X", yaxis_title="Y", zaxis_title="Z"))

fig.show()

  

Output :-

output


Comments

Replay !

0 Comments

Share Your Thoughts

Please enter your name
Please enter a valid email
Password must be at least 6 characters
Please enter your comment
Email Verification Required
We've sent a 6-digit verification code to . Please enter the code below to verify your email address.
Email Verified Successfully!
Your email has been verified. Would you like to proceed with posting your comment?

Type "YES" to confirm and post your comment, or click Cancel to skip posting.