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

Abhinav Agarwal

Graduate Student at Northwestern University
linkedin profile url

I come from Northwestern University, which is ranked 9th in the US. Although the high-quality academics at school taught me all the basics I needed, obtaining practical experience was a challenge.... Read More

Relevant Projects

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

CycleGAN Implementation for Image-To-Image Translation
In this GAN Deep Learning Project, you will learn how to build an image to image translation model in PyTorch with Cycle GAN.

Build Customer Propensity to Purchase Model in Python
In this machine learning project, you will learn to build a machine learning model to estimate customer propensity to purchase.

Time Series Forecasting Project-Building ARIMA Model in Python
Build a time series ARIMA model in Python to forecast the use of arrival rate density to support staffing decisions at call centres.

Build an End-to-End AWS SageMaker Classification Model
MLOps on AWS SageMaker -Learn to Build an End-to-End Classification Model on SageMaker to predict a patient’s cause of death.

Word2Vec and FastText Word Embedding with Gensim in Python
In this NLP Project, you will learn how to use the popular topic modelling library Gensim for implementing two state-of-the-art word embedding methods Word2Vec and FastText models.

Multilabel Classification Project for Predicting Shipment Modes
Multilabel Classification Project to build a machine learning model that predicts the appropriate mode of transport for each shipment, using a transport dataset with 2000 unique products. The project explores and compares four different approaches to multilabel classification, including naive independent models, classifier chains, natively multilabel models, and multilabel to multiclass approaches.

Classification Projects on Machine Learning for Beginners - 2
Learn to implement various ensemble techniques to predict license status for a given business.

Learn Hyperparameter Tuning for Neural Networks with PyTorch
In this Deep Learning Project, you will learn how to optimally tune the hyperparameters (learning rate, epochs, dropout, early stopping) of a neural network model in PyTorch to improve model performance.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.