How to make 3D camera controls using plotly?

This recipe helps you make 3D camera controls using plotly

Recipe Objective

Make 3D camera controls using plotly.

Camera controls in this there are 3 vectors which will determine the camera position and direction. The 3 vectors are "up, center, eye" there coordinates refer to 3d domain which is (0,0,0) is always the center of the domain, no matter the data values. The up vector determines the up direction on the page. The default is (x=0,y=0,z=1), that is, the z-axis points up. The projection of the center point lies at the center of the view. By default it is (x=0,y=0,z=0).

Step 1 - Import libraries

import plotly.graph_objects as go import plotly.express as px

Step 2 - load dataset

Sample_data = px.data.iris() Sample_data.head()

Step 3 - Plot graph

fig = go.Figure(data=go.Surface(z=Sample_data, showscale=False)) fig.update_layout( title='My iris Data', width=400, height=400, margin=dict(t=40, r=0, l=20, b=20) ) name = 'default' camera = dict( up=dict(x=0, y=0, z=1),

Here in the above we are plotting the graph, the default parameters which are used when layout.scene.camera is not provided.

What Users are saying..

profile image

Ed Godalle

Director Data Analytics at EY / EY Tech
linkedin profile url

I am the Director of Data Analytics with over 10+ years of IT experience. I have a background in SQL, Python, and Big Data working with Accenture, IBM, and Infosys. I am looking to enhance my skills... Read More

Relevant Projects

Stock Price Prediction Project using LSTM and RNN
Learn how to predict stock prices using RNN and LSTM models. Understand deep learning concepts and apply them to real-world financial data for accurate forecasting.

AWS MLOps Project to Deploy Multiple Linear Regression Model
Build and Deploy a Multiple Linear Regression Model in Python on AWS

Loan Eligibility Prediction Project using Machine learning on GCP
Loan Eligibility Prediction Project - Use SQL and Python to build a predictive model on GCP to determine whether an application requesting loan is eligible or not.

Time Series Classification Project for Elevator Failure Prediction
In this Time Series Project, you will predict the failure of elevators using IoT sensor data as a time series classification machine learning problem.

Learn How to Build PyTorch Neural Networks from Scratch
In this deep learning project, you will learn how to build PyTorch neural networks from scratch.

Build a Hybrid Recommender System in Python using LightFM
In this Recommender System project, you will build a hybrid recommender system in Python using LightFM .

Build Regression Models in Python for House Price Prediction
In this Machine Learning Regression project, you will build and evaluate various regression models in Python for house price prediction.

Recommender System Machine Learning Project for Beginners-2
Recommender System Machine Learning Project for Beginners Part 2- Learn how to build a recommender system for market basket analysis using association rule mining.

Digit Recognition using CNN for MNIST Dataset in Python
In this deep learning project, you will build a convolutional neural network using MNIST dataset for handwritten digit recognition.

Build a Multi Class Image Classification Model Python using CNN
This project explains How to build a Sequential Model that can perform Multi Class Image Classification in Python using CNN