当前位置:网站首页>Plot size and resolution with R markdown, knitr, pandoc, beamer
Plot size and resolution with R markdown, knitr, pandoc, beamer
2022-07-01 00:19:00 【Technology feast】
problem :
Doesn't fit on the slide by default, doesn't even print by any other means. Not suitable for slides by default , Not even by any other means .
Here's the .Rmd: Edit: it seems you have to use plot() in every chunk. This is a .Rmd: edit : It seems that you have to use... In every block plot().Second plot now prints. The second figure is now printed .
# Plot should show at high resolution```{r echo=FALSE, comment = ""}# load some datarequire(plyr)rbi <- ddply(baseball, .(year), summarise, mean_rbi = mean(rbi, na.rm = TRUE))``````{r}# plotplot(mean_rbi ~ year, type = "l", data = rbi)```# Second attempt```{r, fig.width = 2, fig.height = 2}plot(mean_rbi ~ year, type = "l", data = rbi)```# Third attempt```{r, out.width = 2, out.height = 2}plot(mean_rbi ~ year, type = "l", data = rbi)```# Fourth attempt```{r, out.width = '200px', out.height = '200px'}plot(mean_rbi ~ year, type = "l", data = rbi)```# Fifth attempt```{r, out.width = '\\maxwidth'}plot(mean_rbi ~ year, type = "l", data = rbi)```Save that as test.Rmd Then compile to tex using beamer: Save as test.Rmd And then use test.Rmd Compiled into tex:
knit("test.Rmd")system("pandoc -s -t beamer --slide-level 1 test.md -o test.tex")Open test.tex in RStudio and click "Compile PDF". stay RStudio Open in test.tex , And then click “ compile PDF”.
I've read Yihui's documentation and hope I haven't missed something really obvious. I have read Yihui Of file , I hope I didn't miss anything very obvious .
Edit new code incorporating Yihui's suggestions. edit Include new codes suggested by Yihui .
```{r setup, include=FALSE}opts_chunk$set(dev = 'pdf')```# Plot should show at high resolution```{r echo=FALSE, comment = ""}# load some datarequire(plyr)rbi <- ddply(baseball, .(year), summarise, mean_rbi = mean(rbi, na.rm = TRUE))``````{r}# plotplot(mean_rbi ~ year, type = "l", data = rbi)```# Second attempt```{r, fig.width = 4, fig.height = 4}plot(mean_rbi ~ year, type = "l", data = rbi)```sessionInfo()
R version 3.0.1 (16/05/2013)Platform: x86_64-pc-linux-gnu (64-bit)Local: [1] LC_CTYPE = en_US.UTF-8 LC_NUMERIC = C LC_TIME = C LC_COLLATE = C [5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C attached base packages:[1] stats graphics grDevices utils datasets methods base other attached packages:[1] plyr_1.8 markdown_0.6 knitr_1.2 rCharts_0.3.51 slidify_0.3.52loaded via a namespace (and not attached): [1] RJSONIO_1.0-3 codetools_0.2-8 digest_0.6.3 evaluate_0.4.3 formatR_0.8 [6] grid_3.0.1 lattice_0.20-15 stringr_0.6.2 tools_3.0.1 whisker_0.3-2 [11] yaml_2.1.7 Solution :
Reference resources : https://stackoom.com/en/question/1DNFK边栏推荐
- 1175. Disposition des nombres premiers / échange de doigts II 104. Nombre de permutations
- Asynchronous transition scenario - generator
- To tell you the truth, ThreadLocal is really not an advanced thing
- Techo youth 2022 academic year college open class: behind the live broadcast of Lianmai, explore how to apply audio and video technology
- Rhai - rust's embedded scripting engine
- The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
- Warmup preheating learning rate "suggestions collection"
- Five minutes to understand the exploratory test
- 2022-2028 global plant peptone industry research and trend analysis report
- 2022-2028 global ethylene oxide scrubber industry research and trend analysis report
猜你喜欢

What is SRM system and how to standardize the internal procurement process of the company

Redis - cache penetration, cache breakdown, cache avalanche

1. crawler's beautifulsoup parsing library & online parsing image verification code

Analysis of 8253a register

conv2d详解--在数组和图像中的使用

New trend of embedded software development: Devops

2022-2028 global weight loss ginger tea industry research and trend analysis report

2022-2028 global plant peptone industry research and trend analysis report

206 page Shanghai BIM Technology Application and development report 2021
![[NLP] [textcnn] text classification](/img/bb/c8fd9f1ed458a88a17b8d5c70d9ce2.png)
[NLP] [textcnn] text classification
随机推荐
2022-2028 global capsule shell industry research and trend analysis report
Examples of topological sequences
Teach you how to use Hal library to get started -- become a lighting master
Ctfshow framework reproduction
8253A寄存器浅析
Redis - cache penetration, cache breakdown, cache avalanche
什么是SRM系统,如何规范公司内部采购流程
2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
conv2d详解--在数组和图像中的使用
Gateway service gateway
[PHP] self developed framework qphp, used by qphp framework
Quick start of wechat applet -- project introduction
Solutions to errors in installing OpenSSL for CentOS 6.3 x64 PHP 5.2.6 extensions
Mysql database query optimization
Shell multitasking to download video at the same time
ABAQUS 2022 latest edition - perfect realistic simulation solution
Software engineering best practices - project requirements analysis
What does it mean to open an account online? Is it safe to open an account online?
Random ball size, random motion collision
Is it safe to buy funds on the compass?