Kaynağa Gözat

Fix image width of side-by-side plots in ggplot2-themes vignette

tags/v0.3.0
Garrick Aden-Buie 6 yıl önce
ebeveyn
işleme
a47bf669c9
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. +4
    -4
      vignettes/ggplot2-themes.Rmd

+ 4
- 4
vignettes/ggplot2-themes.Rmd Dosyayı Görüntüle

like this demonstration plot using the `mpg` dataset from ggplot2, like this demonstration plot using the `mpg` dataset from ggplot2,
changes the colors and fonts of your plot theme. changes the colors and fonts of your plot theme.


```{r ggplot2-demo-1, out.width = "45%", fig.show="hide"}
```{r ggplot2-demo-1, out.width = "48%", fig.show="hide"}
library(ggplot2) library(ggplot2)


g_base <- ggplot(mpg) + g_base <- ggplot(mpg) +
g_base + theme_xaringan() g_base + theme_xaringan()
``` ```


<img src="`r knitr::fig_chunk("ggplot2-demo-1", "png")`" width="45%" /><img src="`r knitr::fig_chunk("ggplot2-demo-2", "png")`" width="45%" />
<img src="`r knitr::fig_chunk("ggplot2-demo-1", "png")`" width="48%" /><img src="`r knitr::fig_chunk("ggplot2-demo-2", "png")`" width="48%" />


With `theme_xaringan()` the fonts and colors match the slide theme. With `theme_xaringan()` the fonts and colors match the slide theme.
The default colors of points (like other geometries) has been changed as well The default colors of points (like other geometries) has been changed as well
g_base + theme_xaringan_inverse() g_base + theme_xaringan_inverse()
``` ```


<img src="`r knitr::fig_chunk("ggplot2-demo-2", "png")`" width="45%" /><img src="`r knitr::fig_chunk("ggplot2-demo-inverse", "png")`" width="45%" />
<img src="`r knitr::fig_chunk("ggplot2-demo-2", "png")`" width="48%" /><img src="`r knitr::fig_chunk("ggplot2-demo-inverse", "png")`" width="48%" />




## Using `theme_xaringan()` without calling a style function {#using-xaringan-themer-css} ## Using `theme_xaringan()` without calling a style function {#using-xaringan-themer-css}
Color scales matching the inverse slides are possible Color scales matching the inverse slides are possible
by setting the argument `inverse = TRUE`. by setting the argument `inverse = TRUE`.


```{r scale-xaringan, fig.width = 9, fig.height = 5, out.width="45%", fig.show="hold", echo = TRUE}
```{r scale-xaringan, fig.width = 9, fig.height = 5, out.width="48%", fig.show="hold", echo = TRUE}
ggplot(diamonds, aes(x = cut)) + ggplot(diamonds, aes(x = cut)) +
geom_bar(aes(fill = ..count..), show.legend = FALSE) + geom_bar(aes(fill = ..count..), show.legend = FALSE) +
labs(x = NULL, y = "Count", title = "Diamond Cut Quality") + labs(x = NULL, y = "Count", title = "Diamond Cut Quality") +

Yükleniyor…
İptal
Kaydet