当前位置:网站首页>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边栏推荐
- Using Excel to quickly generate SQL statements
- New trend of embedded software development: Devops
- 让企业数字化砸锅和IT主管背锅的软件供应链安全风险指北
- 1175. 质数排列 / 剑指 Offer II 104. 排列的数目
- Software engineering best practices - project requirements analysis
- 2022-2028 global plant peptone industry research and trend analysis report
- 8253A寄存器浅析
- Error 2059 when Navicat connects to MySQL
- Operation record of reinitialization instance of Dameng database
- Summer Challenge [FFH] harmonyos mobile phone remote control Dayu development board camera
猜你喜欢

Implementation of OSD on Hisilicon platform (1)

Introduction to ES6 promise, new features of ES7 and es8 async and await

CentOS installation starts redis

The programmer's girlfriend gave me a fatigue driving test

Redis - how to understand publishing and subscribing

2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
![[UML] UML class diagram](/img/6f/30bd15967103969e600d69e618d8bf.png)
[UML] UML class diagram

Design e-commerce seckill system

Quick start of wechat applet -- project introduction

Analysis of 8253a register
随机推荐
如何关闭一个开放的DNS解析器
LVM snapshot: backup based on LVM snapshot
2022-2028 global single travel industry research and trend analysis report
C WinForm program interface optimization example
Development of wireless U-shaped ultrasonic electric toothbrush
1175. 质数排列 / 剑指 Offer II 104. 排列的数目
Software supply chain security risk pointing North for enterprise digitalization and it executives
How to distinguish between platform security and online hype? What are the stop loss techniques for online speculation?
2022-2028 global ICT test probe industry research and trend analysis report
[untitled]
2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report
File reading and writing for rust file system processing - rust Practice Guide
Is it safe to open a stock account of Huatai Securities online?
What is the fastest way to import data from HDFS to Clickhouse? Spark is imported through JDBC or HDFS
Shell multitasking to download video at the same time
Dell r720 server installation network card Broadcom 5720 driver
Vmware16 installing win11 virtual machine (the most complete step + stepping on the pit)
leetcode 474. Ones and Zeroes 一和零(中等)
How to close an open DNS resolver
The programmer's girlfriend gave me a fatigue driving test