Plotting in R

What may be confusing at first if you look at graphic examples is that R has several independent graphic engines. Think of it like having several drawing artists, every one with his/her own style. You can decide which one you want to use to represent your data. The two main one are

  • The standard graphic device, see many examples below
  • ggplot2, see here

There are more graphics engines though. Here is a list of graphic packages that are available and how they fit together

Basic plotting example

The basic plotting command for the standard graphics output is plot() - this is a very simple example:

x = 1:10
y = rnorm(10)
plot(x,y)

Here are some (hopefully) useful links on how to do more complicated graphics: