Skip to main content

3.5) Other Kinds Of Plot


You should also know about hist() for calculating and plotting histograms and barplot() for making bar-charts. For customized boxplots, use boxplot().

  • Look at some histograms of the columns of GRASS. Also try hist(GRASS$Dms, plot=FALSE), to see the workings behind the graph. Then store just the mid-points of the bars and the density values for each bar (assign each of these vectors to objects with names of your choice), and see if you can plot a line version of the histogram using plot(). (Hint: Try the option type="s".)
  • Now, using plot(), you could plot a frequency graph with a log-transformed y axis. This could be useful one day!

If you may want to revisit plots that you produce without producing them afresh, select the graphics window, go to the History menu and click on “Recording”. Then later on you can use the Page Up and Page Down keys to scroll back and forth through subsequent plots. If you close a graphics window, a new one will open when you next plot a graph, but you will probably lose any changes to the par() parameters you had made. So this is a way of restoring the default parameters.