|
|
|
|
|
|
|
|
collapse = TRUE, |
|
|
collapse = TRUE, |
|
|
warning = FALSE, |
|
|
warning = FALSE, |
|
|
comment = "#>", |
|
|
comment = "#>", |
|
|
fig.width = 6, |
|
|
|
|
|
|
|
|
fig.width = 6, |
|
|
fig.height = 4 |
|
|
fig.height = 4 |
|
|
) |
|
|
) |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
```{r ggplot2-demo-1, out.width = "48%", fig.show="hide"} |
|
|
```{r ggplot2-demo-1, out.width = "48%", fig.show="hide"} |
|
|
library(ggplot2) |
|
|
library(ggplot2) |
|
|
|
|
|
|
|
|
g_base <- ggplot(mpg) + |
|
|
|
|
|
aes(hwy, cty) + |
|
|
|
|
|
|
|
|
g_base <- ggplot(mpg) + |
|
|
|
|
|
aes(hwy, cty) + |
|
|
geom_point() + |
|
|
geom_point() + |
|
|
labs(x = "Highway MPG", y = "City MPG", title = "Fuel Efficiency") |
|
|
labs(x = "Highway MPG", y = "City MPG", title = "Fuel Efficiency") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- `header_font_google = google_font("Oleo Script")`. |
|
|
- `header_font_google = google_font("Oleo Script")`. |
|
|
|
|
|
|
|
|
```{r text demo, fig.width = 10} |
|
|
```{r text demo, fig.width = 10} |
|
|
g_diamonds_with_text <- |
|
|
|
|
|
g_diamonds + |
|
|
|
|
|
|
|
|
g_diamonds_with_text <- |
|
|
|
|
|
g_diamonds + |
|
|
geom_text(aes(y = ..count.., label = format(..count.., big.mark = ",")), |
|
|
geom_text(aes(y = ..count.., label = format(..count.., big.mark = ",")), |
|
|
vjust = -0.30, size = 8, stat = "count") + |
|
|
|
|
|
|
|
|
vjust = -0.30, size = 8, stat = "count") + |
|
|
labs(x = "Cut", y = "Count") |
|
|
labs(x = "Cut", y = "Count") |
|
|
|
|
|
|
|
|
g_diamonds_with_text + theme_xaringan() |
|
|
g_diamonds_with_text + theme_xaringan() |
|
|
|
|
|
|
|
|
```{r eval=FALSE} |
|
|
```{r eval=FALSE} |
|
|
font_url <- file.path( |
|
|
font_url <- file.path( |
|
|
"https://fontlibrary.org/assets/fonts/glacial-indifference/", |
|
|
"https://fontlibrary.org/assets/fonts/glacial-indifference/", |
|
|
"5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982", |
|
|
|
|
|
|
|
|
"5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982", |
|
|
"GlacialIndifferenceRegular.ttf" |
|
|
"GlacialIndifferenceRegular.ttf" |
|
|
) |
|
|
) |
|
|
|
|
|
|