Plotgröße und Auflösung mit R Markdown, Knitr, Pandoc, Beamer

Passen nicht auf der Folie standardmäßig nicht drucken Sie sogar durch andere Mittel.

Hier ist die .Rmd: Edit: es scheint, Sie haben die Verwendung von plot() in jedem Block. Zweite Handlung druckt nun.

# Plot should show at high resolution

```{r echo=FALSE, comment = ""}
# load some data
require(plyr)
rbi <- ddply(baseball, .(year), summarise,  
  mean_rbi = mean(rbi, na.rm = TRUE))
```

```{r}
# plot
plot(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)
```

Speichern, als test.Rmd
Dann kompilieren tex Verwendung von beamer:

knit("test.Rmd")
system("pandoc -s -t beamer --slide-level 1 test.md -o test.tex")

Öffnen test.tex in RStudio, und klicken Sie auf "Kompilieren PDF".

Ich gelesen habe, Yihui ' s Dokumentation und hoffe, ich habe nicht verpasst, etwas wirklich offensichtlich.

Bearbeiten neuen code einbinden Yihui ' s-Vorschläge.

```{r setup, include=FALSE}
opts_chunk$set(dev = 'pdf')
```

# Plot should show at high resolution

```{r echo=FALSE, comment = ""}
# load some data
require(plyr)
rbi <- ddply(baseball, .(year), summarise,  
  mean_rbi = mean(rbi, na.rm = TRUE))
```

```{r}
# plot
plot(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.52

loaded 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  

InformationsquelleAutor der Frage nacnudus | 2013-07-31

Schreibe einen Kommentar