Creating a Line Chart in R
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.
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.
Get unlimited access to all courses and premium content