Creating a Line Chart in R

Premium

In R, we can create a line plot using the same plot() function by adding a plot type of "l". This will plot the (x,y) paired observations and connect them with lines.

plot(x,y,type="l")

Let's generate our own data for this lesson. We will use the rnorm() function to generate a set of 100 random numbers that follow a normal distribution. These random numbers will be plotted on y-axis. x-axis will be a sequence of numbers from 1 to 100.

Continue Reading
Premium Content

This tutorial is a part of the course Data Visualization with R. This is a premium course. The purchase options for the course are provided below. With this course, you get access to complete course content, source code, practical exercises, and all resources that are a part of the course.

Lifetime Premium Membership
$250
$179

Get unlimited access to all courses and premium content

Join Premium
Individual Course
$7

Purchase this course individually

Purchase CourseView Course Details
What's Included:
Complete access to course content and updates
All downloadable resources
Interactive course quizzes
Practice exercises and sample code
Ad-free learning experience