What does lines function do to a plot in R?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

# What does lines function do to a plot in R?

This recipe explains what does lines function do to a plot in R

## Recipe Objective

What does lines function do to a plot in R? A line graph is a graphical representation of the relationship between two variables. The line is plotted by connecting the points by joining the line segments between them. Lines () function is used for plotting more than one line on a line chart. Once the first line is plotted, we can use the lines () function to add another input vector to draw the second line in the line chart. The following recipe gives an example of the lines () function.

## Step 1 - Create data for plotting

``` x <- c(1:10) y1 <- x*2 y2 <- x*3 ```

## Step 2 - Apply plot() and lines()

syntax - lines(x) where , x - the input vector values of second line

``` plot(x,y1,type='b',frame=FALSE,pch=10,col='blue',xlab='x_data',ylab='y_data') lines(x,y2,type='b',col='green',pch=10,lty=1) legend('topright',legend=c('Line 1','Line 2'),col=c('green','blue'),lty=1,cex=0.8) ```

#### Relevant Projects

##### House Price Prediction Project using Machine Learning
Use the Zillow dataset to follow a test-driven approach and build a regression machine learning model to predict the price of the house based on other variables.

##### 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.

##### Loan Eligibility Prediction in Python using H2O.ai
In this loan prediction project you will build predictive models in Python using H2O.ai to predict if an applicant is able to repay the loan or not.

##### PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

##### Machine learning for Retail Price Recommendation with Python
Use the Mercari Dataset with dynamic pricing to build a price recommendation algorithm using machine learning in Python to automatically suggest the right product prices.

##### Abstractive Text Summarization using Transformers-BART Model
Deep Learning Project to implement an Abstractive Text Summarizer using Google's Transformers-BART Model to generate news article headlines.

##### 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.

##### Census Income Data Set Project - Predict Adult Census Income
Use the Adult Income dataset to predict whether income exceeds 50K yr based on census data.

##### Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

##### Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.