Add a plot to a pdf by generating R markdown, intended to be used within the expr
argument to write_pdf
Examples
library(ggplot2)
#>
#> Attaching package: ‘ggplot2’
#> The following object is masked from ‘package:tessireport’:
#>
#> %+%
p <- ggplot(data.frame(x=runif(100))) + geom_histogram(aes(x))
write_pdf(pdf_plot(p, title = "Sample plot", subtitle = "histogram of random numbers"))
#> 1/1
#>
#>
#> processing file: file217443bcf9ab.Rmd
#> 1/3
#> 2/3 [setup]
#> 3/3 [unnamed-chunk-1]
#> output file: file217443bcf9ab.knit.md
#> /opt/hostedtoolcache/pandoc/3.1.11/x64/pandoc +RTS -K512m -RTS file217443bcf9ab.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmpj9lPU7/file2174a01674a.tex --lua-filter /home/runner/work/_temp/Library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/runner/work/_temp/Library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --highlight-style tango --pdf-engine xelatex --variable graphics --include-in-header /tmp/Rtmpj9lPU7/rmarkdown-str217473cbadf9.html
#> Warning: error in running command
#> ! sh: 1: xelatex: not found
#> Error: LaTeX failed to compile /tmp/Rtmpj9lPU7/file2174a01674a.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See file2174a01674a.log for more info.