Skip to content

Instantly share code, notes, and snippets.

@barryrowlingson
Created October 13, 2017 17:32
Show Gist options
  • Save barryrowlingson/28c502d45830b2736ae8211b055bedce to your computer and use it in GitHub Desktop.
Save barryrowlingson/28c502d45830b2736ae8211b055bedce to your computer and use it in GitHub Desktop.
R markdown that has a problem with tmap_arrange..
> packageVersion("tmap")
[1] ‘1.8’
> packageVersion("rmarkdown")
[1] ‘1.5’
---
output:
html_document:
toc: true
---
Here's how I run this. Note my default graphics device isn't cairo-enabled, so the
first line is needed.
```
options(bitmapType="cairo")
library(rmarkdown)
render("fnord.Rmd","html_document")
```
If I haven't started a graphics device then the output HTML has the images in. If I *have*
started a graphics device, for example:
```
X11(type="cairo")
```
then the maps get drawn to that and don't appear in the HTML output.
```{r test}
library(tmap)
data(World)
w1 <- qtm(World, projection = "eck4", title="Eckert IV")
w2 <- qtm(World, projection = "merc", title="Mercator")
# tmap_mode("plot")
tmap_arrange(w1, w2)
# tmap_mode("plot")
```
@barryrowlingson
Copy link
Author

Note that mucking with tmap_mode("plot") here and there modifies the behaviour in weird and unusual ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment