I'm using knitr with RStudio, generating html reports. My report contains many plots of various sizes, some are small and some are much wider. I use fig.width and fig.height per chunk to specify the size. Till yesterday I used RStudio 0.98.50* and it was rendered just perfectly - each plot with its own size, horizontal scrollbar appeared if some plots were too big. However I wanted to get TOC added to the reports and thus upgraded to the latest RStudio 0.98.1091.
Since the upgrade, all the fig.width/fig.height chunk settings seem to be just ignored. The HTML shows all plots of the same size, scalled, no scrolling. If I use the comment <!-- rmarkdown v1 -->
all gets back to normal and looks like before but the TOC is gone.
Code Example
---
title: "Example"
output: html_document
---
<!-- rmarkdown v1 -->
```{r}
library(NMF)
# Generate random data
n <- 50; p <- 20
x <- abs(rmatrix(n, p, rnorm, mean=4, sd=1))
x[1:10, seq(1, 10, 2)] <- x[1:10, seq(1, 10, 2)] + 3
x[11:20, seq(2, 10, 2)] <- x[11:20, seq(2, 10, 2)] + 2
rownames(x) <- paste("ROW", 1:n)
colnames(x) <- paste("COL", 1:p)
```
```{r plot_small, fig.width=10, fig.height=25}
aheatmap(x)
```
```{r plot_big, fig.width=100, fig.height=45}
aheatmap(x)
```
If <!-- rmarkdown v1 -->
is present, the result HTML looks as expected - plot_small is small, plot_big is much wider, horizontal scrollbar appears. If <!-- rmarkdown v1 -->
is removed the result HTML looks very different - both plots have the same size, the plot_big is scaled, no scrolling. I think probably explained by those lines in the HTML:
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
height: auto;
}
I'd appreciate any ideas of either how to get TOC generated with v1 or plot size set as requested with v2. Thanks