Ch. 2 | Exercise 2

Chapter 2 | Exercise 2

Make a plot with the help of the following code:

> x <- seq(0, 30, by = 0.05) > plot(sin(x), col = rainbow(125))

Save the file in the .png format in a local directory.

First, open the graphics device and specify the output file:

> png("Your/Directory/monthnames.png") # specify your own path and file name

Next, create the plot:

> x <- seq(0, 30, by = 0.05) > plot(sin(x), col = rainbow(125))

Finally, close the device:

> dev.off()

To inspect the plot, go to the directory where you saved the file.