Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ch02.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ggplot(BOD, aes(x = factor(Time), y = demand)) +
geom_col()
```

ggplot2 can also be used to plot the *count* of the number of data rows in each category (Figure \@ref(fig:FIG-QUICK-BAR-GGPLOT-COUNT), by using `geom_bar()` instead of `geom_col()`. Once again, notice the difference between a continuous x-axis and a discrete one. For some kinds of data, it may make more sense to convert the continuous x variable to a discrete one, with the `factor()` function.
ggplot2 can also be used to plot the *count* of the number of data rows in each category (Figure \@ref(fig:FIG-QUICK-BAR-GGPLOT-COUNT)), by using `geom_bar()` instead of `geom_col()`. Once again, notice the difference between a continuous x-axis and a discrete one. For some kinds of data, it may make more sense to convert the continuous x variable to a discrete one, with the `factor()` function.

(ref:cap-FIG-QUICK-BAR-GGPLOT-COUNT) Bar graph of counts using `geom_bar()` with a continuous x variable (left); With x variable converted to a factor (right)

Expand Down Expand Up @@ -385,4 +385,4 @@ ggplot(data.frame(x = c(0, 20)), aes(x = x)) +

### See Also

See Recipe \@ref(RECIPE-MISCGRAPH-FUNCTION) for more in-depth information about plotting function curves.
See Recipe \@ref(RECIPE-MISCGRAPH-FUNCTION) for more in-depth information about plotting function curves.