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.

Unlock Premium Content

Upgrade your account to access the full article, downloads, and exercises.

You'll get access to:

  • Access complete tutorials and examples
  • Download source code and resources
  • Follow along with practical exercises
  • Get in-depth explanations

Course Downloads

eBook - Data Visualization with R

eBook for Data Visualization with R

PDF
Premium
Upgrade to Pro

Data and R Code

Data and R Code Files for Data Visualization with R

ZIP
Premium
Upgrade to Pro