options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(fig.dim=c(4.8, 4.5), fig.retina=2, out.width="100%")
knitr::opts_hooks$set(fig.callout = function(options) {
  if (options$fig.callout) {
    options$echo <- FALSE
    options$out.height <- "99%"
    options$fig.width <- 16
    options$fig.height <- 8
  }
  options
})
library(ggplot2)

```{css, echo=FALSE} / custom.css / .left-code { color: #777; width: 38%; height: 92%; float: left; } .right-plot { width: 60%; float: right; padding-left: 1%; } .plot-callout { height: 225px; width: 450px; bottom: 5%; right: 5%; position: absolute; padding: 0px; z-index: 100; } .plot-callout img { width: 100%; border: 4px solid #23373B; }

<!-- Works with xaringan's default CSS -->

.pull-left[
```r
# code chunk here
ggplot(iris) +
  aes(Sepal.Length,
      Sepal.Width,
      color = Species) +
  geom_point()

]

.pull-right[


]


.left-code[

# code chunk here
ggplot(iris) +
  aes(Sepal.Length,
      Sepal.Width,
      color = Species) +
  geom_point()

]

.right-plot[


]


ggplot(iris) +
  aes(Sepal.Length,
      Sepal.Width,
      color = Species) +
  geom_point(size = 4) +
  labs(x = 'Sepal Length',
       y = 'Sepal Width') +
  theme_minimal() +
  theme(
    text = element_text(size = 24, family = "PT Sans")
  )

.plot-callout[


]




.left-code[

# code chunk here
ggplot(iris) +
  aes(Sepal.Length,
      Sepal.Width,
      color = Species) +
  geom_point()

From ?knitr::fig_chunk

You can generate plots in a code chunk but not show them inside the code chunk by using the chunk option fig.show = 'hide'. Then you can use this function if you want to show them elsewhere. ]

.right-plot[ ]

.footnote[ ![](`r knitr::fig_chunk("plot-label", "png")`) ]



wolski/p3003PBC documentation built on Nov. 30, 2024, 7:14 a.m.