0
votes

While creating an HTML doc using the excellent knitr package, I noticed that sometimes the script would crash and sometimes not. After much poking around, I realized that it was simply due to the fig.height parameter in the chunk header

This caused a crash:
```{r, heatmap_res, eval=TRUE, echo=FALSE, fig.height=200}

yet this was OK and yielded all graphs as expected:
```{r, heatmap_res, eval=TRUE, echo=FALSE, fig.height=100}

Here is a reproducible example using ggplot2's diamonds dataset:

---
title: "figheight"
author: "Hackr"
date: "June 24, 2015"
output: html_document
---

```{r, heatmap_res, eval=TRUE, echo=FALSE, fig.height=200}

library(ggplot2)

data(diamonds)

ggplot(diamonds, aes(cut, price, fill = depth)) + geom_tile() + facet_wrap(~ clarity + color, ncol = 1) 
```

So what is the maximum value allowed in the fig.height parameter? Also what units is this value? inches?

Thanks, Hackr

1
with fig.height = 200 my R does not crash... it is laggy but runs.SabDeM

1 Answers

2
votes

The chunk option fig.height is in inches. Normally you do not want a figure of 200 inches tall, although in theory there is no upper limit of the figure height.