I am using R notebook. This is my chunk:
```{r}
test = matrix(rnorm(200), 20, 10)
pheatmap::pheatmap(test)
```
I guess it's due to the way pheatmap
generates the plot, but it actually generates a blank plot first. Thus, this is the output I see:
How do I get rid of that first image? I see it in the RStudio output (screenshot above) and in the .nb.html
file. If I knit to HTML, the blank plot is not there.
I tried different fig.keep
options. They work when I knit to HTML, but they don't seem to have an effect in the .nb.html
file. How can I get rid of it?
Update: This issue was fixed in pheatmap. It may still be applicable to other scenarios.
This is weird. Try this:
```{r}
library(pheatmap)
p <- pheatmap(test, silent = TRUE)
plot(p$gtable)
```
It produces exactly what you describe. Now, split it into two chunks.
```{r}
library(pheatmap)
p <- pheatmap(test, silent = TRUE)
```
```{r}
plot(p$gtable)
```
It works! I have no idea why, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With