当前位置:网站首页>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边栏推荐
- 8253A寄存器浅析
- On the application of cluster analysis in work
- Why should VR panoramic shooting join us? Leverage resources to achieve win-win results
- Error 2059 when Navicat connects to MySQL
- lvm-snapshot:基于LVM快照的备份之准备工作
- What is SRM system and how to standardize the internal procurement process of the company
- The girlfriend said: if you want to understand the three MySQL logs, I will let you heiheihei!
- Maxpool2d explanation -- Application in arrays and images
- LVM snapshot: backup based on LVM snapshot
- C WinForm program interface optimization example
猜你喜欢

How does the VR cloud exhibition hall bring vitality to offline entities? What are the functions?

MaxPool2d详解--在数组和图像中的应用

让企业数字化砸锅和IT主管背锅的软件供应链安全风险指北

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

2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report

Ditto set global paste only text shortcuts

SSM integration process (integration configuration, function module development, interface test)

Quick start of wechat applet -- project introduction

2022-2028 global PTFE lined valve industry research and trend analysis report

2022-2028 global plant peptone industry research and trend analysis report
随机推荐
深入理解 Jetpack Compose 内核:SlotTable 系统
What SQL statements are supported for data filtering
Why should VR panoramic shooting join us? Leverage resources to achieve win-win results
2022-2028 global retro glass industry research and trend analysis report
Techo youth 2022 academic year college open class: behind the live broadcast of Lianmai, explore how to apply audio and video technology
C /platform:anycpu32bitpererrored can only be used with /t:exe, /t:winexe and /t:appcontainerexe
Don't worry about whether you can be a coder if you don't learn English well. Learn it first
Excuse me, does Flink support synchronizing data to sqlserver
What does it mean to open an account online? Is it safe to open an account online?
Pycharm is very fast to learn from installation to full armament. There are so many pictures because it is too detailed!
Reason why wechat payment wxpaypubhelper V3 callback XML is empty
LVM snapshot: preparation of backup based on LVM snapshot
How do it outsourcing resident personnel position their pain points?
2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
Red hat will apply container load server on project atomic
2022-2028 global ICT test probe industry research and trend analysis report
Using Excel to quickly generate SQL statements
How to edit special effects in VR panorama? How to display detailed functions?
高等数学建模
2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report