Skip to content

Correct text and caption of Figure 3.8 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions ch03.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ diamonds

With `geom_bar()`, the default behavior is to use `stat = "bin"`, which counts up the number of cases for each group (each *x* position, in this example). In the graph we can see that there are about 23,000 cases with an `ideal` cut.

In this example, the variable on the x-axis is discrete. If we use a continuous variable on the x-axis, we'll get a bar at each unique *x* value in the data, as shown in Figure \@ref(fig:FIG-BAR-GRAPH-COUNT-CONTINUOUS), left:
In this example, the variable on the x-axis is discrete. If we use a continuous variable on the x-axis, we'll get a bar at each unique *x* value in the data, as shown in Figure \@ref(fig:FIG-BAR-GRAPH-COUNT-CONTINUOUS), top:

```{r FIG-BAR-GRAPH-COUNT-CONTINUOUS, echo=FALSE, message=FALSE, fig.show="hold", fig.cap='Bar graph of counts on a continuous axis (left); A histogram (right)', fig.width=6, fig.height=3}
```{r FIG-BAR-GRAPH-COUNT-CONTINUOUS, echo=FALSE, message=FALSE, fig.show="hold", fig.cap='Bar graph of counts on a continuous axis (top); A histogram (bottom)', fig.width=6, fig.height=3}
# Bar graph of counts
ggplot(diamonds, aes(x = carat)) +
geom_bar()
Expand All @@ -186,7 +186,7 @@ ggplot(diamonds, aes(x = carat)) +
geom_histogram()
```

The bar graph with a continuous x-axis is similar to a histogram, but not the same. A histogram is shown on the right of Figure \@ref(fig:FIG-BAR-GRAPH-COUNT-CONTINUOUS). In this kind of bar graph, each bar represents a unique *x* value, whereas in a histogram, each bar represents a *range* of *x* values.
The bar graph with a continuous x-axis is similar to a histogram, but not the same. A histogram is shown on the bottom of Figure \@ref(fig:FIG-BAR-GRAPH-COUNT-CONTINUOUS). In this kind of bar graph, each bar represents a unique *x* value, whereas in a histogram, each bar represents a *range* of *x* values.


### See Also
Expand Down Expand Up @@ -766,4 +766,4 @@ ggplot(tophit, aes(x = avg, y = name)) +

For more on changing the order of factor levels, see Recipe \@ref(RECIPE-DATAPREP-FACTOR-REORDER). Also see Recipe \@ref(RECIPE-DATAPREP-FACTOR-REORDER-VALUE) for details on changing the order of factor levels based on some other values.

For more on moving the legend, see Recipe \@ref(RECIPE-LEGEND-POSITION). To hide grid lines, see Recipe \@ref(RECIPE-APPEARANCE-HIDE-GRIDLINES).
For more on moving the legend, see Recipe \@ref(RECIPE-LEGEND-POSITION). To hide grid lines, see Recipe \@ref(RECIPE-APPEARANCE-HIDE-GRIDLINES).