Skip to content

Commit

Permalink
sync viz with python book; remove old style syntax fig
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Dec 23, 2023
1 parent f587a05 commit 9c4c7cf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
Binary file removed img/viz/ggplot_function_scatter.jpeg
Binary file not shown.
21 changes: 1 addition & 20 deletions source/viz.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -282,33 +282,14 @@ There are a few basic aspects of a plot that we need to specify:
- To create a geometric object, we use a `geom_*` function (see the [ggplot reference](https://ggplot2.tidyverse.org/reference/) for a list of geometric objects).
- Here, we use the `geom_point` function to visualize our data as a scatter plot.

Figure \@ref(fig:03-ggplot-function-scatter)
shows how each of these aspects map to code
for creating a basic scatter plot of the `co2_df` data.
Note that we could pass many other possible arguments to the aesthetic mapping
and geometric object to change how the plot looks. For the purposes of quickly
testing things out to see what they look like, though, we can just start with the
default settings.
\index{ggplot!aes}
\index{ggplot!geom\_point}

(ref:03-ggplot-function-scatter) Creating a scatter plot with the `ggplot` function.

```{r 03-ggplot-function-scatter, echo = FALSE, fig.align = "center", fig.cap = "(ref:03-ggplot-function-scatter)", message = FALSE, out.width = "100%"}
image_read("img/viz/ggplot_function_scatter.jpeg") |>
image_crop("1625x1900")
```

\newpage

```{r 03-data-co2-scatter, warning=FALSE, message=FALSE, fig.height = 3.1, fig.width = 4.5, fig.align = "center", fig.cap = "Scatter plot of atmospheric concentration of CO$_{2}$ over time."}
co2_scatter <- ggplot(co2_df, aes(x = date_measured, y = ppm)) +
geom_point()
co2_scatter
```

Certainly, the visualization in Figure \@ref(fig:03-data-co2-scatter)
The visualization in Figure \@ref(fig:03-data-co2-scatter)
shows a clear upward trend
in the atmospheric concentration of CO$_{\text{2}}$ over time.
This plot answers the first part of our question in the affirmative,
Expand Down

0 comments on commit 9c4c7cf

Please sign in to comment.