How to plot scatter plot using plot function in R?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

How to plot scatter plot using plot function in R?

How to plot scatter plot using plot function in R?

This recipe helps you plot scatter plot using plot function in R

0

Recipe Objective

How to plot scatter plot using plot function in R? Scatter plots are graphs that represent a relation between an independent variable (x) and a dependent variable (y). The plot represents data on a 2 dimensional plane, where dependent variable (y) is plotted on the Y-axis and an independent variable (x) is plotted on the X-axis. Scatter plots are used to explain the correlation between the two variables. There are mainly 3 cases in scatter plot correlation – - Positive correlation - Negative correlation - No correlation Scatter plots help us understand and visualize the data properly. This recipe demonstrates an example of scatter plots.

Step 1 - Define the 2 vectors

x <- c(2,3,8,9,4,6,9,7,6,9) y <- c(3,9,5,6,8,6,5,8,9,3)

Step 2 - Plot the graph

Syntax for scatter plot - plot(x, y, main, xlab, ylab, xlim, ylim, axes) where, x - independent data points, y -independent data points, main - title of the correlation plot, xlab - title of the x axis, ylab - title of the y axis, xlim - limits for x axis data points, ylim - limits for y axis data points, axes - whether both the axes should be drawn on the plot.

plot(x,y,main="Correlation between x and y",xlab="x data points", ylab= "y data points", xlim=c(1,10),ylim=c(1,10))

Step 3 - Find the correlation

corelation <- cor(x,y) corelation # the scatter plot shows a negative correlation between the two variables.
 "Correlation between the two variables is :" -0.259788098433717 

Relevant Projects

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Zillow’s Home Value Prediction (Zestimate)
Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

Human Activity Recognition Using Multiclass Classification in Python
In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

Predict Census Income using Deep Learning Models
In this project, we are going to work on Deep Learning using H2O to predict Census income.

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

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

Predict Employee Computer Access Needs in Python
Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.