From b0fef488af1f55911f0cb4ef4d6146fac3d1a46f Mon Sep 17 00:00:00 2001 From: Bob Clark Date: Thu, 22 Jun 2017 13:46:58 -0700 Subject: [PATCH] 05 - Data visualization, ggplot2 changes no error Latest version of ggplot 2 does not produce the error in the original text --- 05-data-visualization.Rmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/05-data-visualization.Rmd b/05-data-visualization.Rmd index 317c227..1c2e463 100644 --- a/05-data-visualization.Rmd +++ b/05-data-visualization.Rmd @@ -77,7 +77,7 @@ boxplot(genome_size ~ cit, metadata, col=c("pink","purple", "darkgrey"), More recently, R users have moved away from base graphic options and towards a plotting package called [`ggplot2`](http://docs.ggplot2.org/) that adds a lot of functionality to the basic plots seen above. The syntax takes some getting used to but it's extremely powerful and flexible. We can start by re-creating some of the above plots but using ggplot functions to get a feel for the syntax. -`ggplot` is best used on data in the `data.frame` form, so we will will work with `metadata` for the following figures. Let's start by loading the `ggplot2` library. +`ggplot2` is best used on data in the `data.frame` form, so we will will work with `metadata` for the following figures. Let's start by loading the `ggplot2` library. ```{r} library(ggplot2) @@ -85,10 +85,10 @@ library(ggplot2) The `ggplot()` function is used to initialize the basic graph structure, then we add to it. The basic idea is that you specify different parts of the plot, and add them together using the `+` operator. -We will start with a blank plot and will find that you will get an error, because you need to add layers. +We will start with a blank plot and will add layers as we go along. ```{r, eval=FALSE} -ggplot(metadata) # note the error +ggplot(metadata) ``` Geometric objects are the actual marks we put on a plot. Examples include: