Explain scatter plots in plotly with various functions?

This recipe explains what scatter plots in plotly with various functions

Recipe Objective

Explain scatter plots in plotly with various functions in it.

Scatter plot are also known as Scatter graph, which uses cartesian coordinates to display the values for typically two variables for a dataset

Step 1 - Import the necessary libraries

import plotly.express as px

Step 2 - load the sample datset

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

Step 3 - Plot the graph

fig = px.scatter(Sample_data, x="centroid_lat", y="car_hours", color="peak_hour", marginal_y="violin", marginal_x="box", trendline="ols", template="simple_white", ) fig.show()

Here the above figure shows the scatter plot with various function:

x, and y shows the data should be presented on that particular axis.

marginal_x - visualizing the x distribution, horizontal subplot is drawn above the main plot.

marginal_y - visualizing the y distribution, vertical subplot is drawn to the right of the main plot.

trendline - these added the ordinal least squares (OLS) regression trendlines or non-linear Locally Weighted Scatterplot Smoothing (LOEWSS) trendlines to scatterplots.

template - themes acn be implemented usin templates, these are slightly more general than traditional themes because in addition to defining default styles, templates can pre-populate a figure with visual elements like annotations, shapes, images, and more.

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Build a Face Recognition System in Python using FaceNet
In this deep learning project, you will build your own face recognition system in Python using OpenCV and FaceNet by extracting features from an image of a person's face.

Machine Learning Project to Forecast Rossmann Store Sales
In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

Build OCR from Scratch Python using YOLO and Tesseract
In this deep learning project, you will learn how to build your custom OCR (optical character recognition) from scratch by using Google Tesseract and YOLO to read the text from any images.

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 .

LLM Project to Build and Fine Tune a Large Language Model
In this LLM project for beginners, you will learn to build a knowledge-grounded chatbot using LLM's and learn how to fine tune it.

Build a Credit Default Risk Prediction Model with LightGBM
In this Machine Learning Project, you will build a classification model for default prediction with LightGBM.

Learn How to Build a Logistic Regression Model in PyTorch
In this Machine Learning Project, you will learn how to build a simple logistic regression model in PyTorch for customer churn prediction.

MLOps Project on GCP using Kubeflow for Model Deployment
MLOps using Kubeflow on GCP - Build and deploy a deep learning model on Google Cloud Platform using Kubeflow pipelines in Python

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.