Questions tagged [tmap]

tmap is an actively maintained open-source R-library for drawing thematic maps, written by Martijn Tennekes. The API is based on the Layered Grammar of Graphics, and resembles the syntax of ggplot2, a popular R-library for drawing charts.

tmap is an actively maintained open-source R-library for drawing thematic maps, written by Martijn Tennekes. The API is based on A Layered Grammar of Graphics by Hadley Wickham and resembles the syntax of , a popular R-library for drawing charts.

Repositories

Vignette

Presentation

Other resources

487 questions
0
votes
0 answers

Make Attribute of Shapefile a Selectable Hyperlink in R

I have a shapefile that I export from QGIS and load using the sf library in R. The shapefile contains an attribute "description" which is a link to a website. I use this shapefile to create an interactive leaflet map. I would like the "description"…
Dan
  • 352
  • 3
  • 11
0
votes
1 answer

How to display only some country names with tm_text in R

I have created a map of Africa in R, using tmap, showing some numerical variables, but I would like to show the name of the countries only for the countries where the numerical variable is not 0. So I have created a colour vector containing the…
Lucie
  • 3
  • 4
0
votes
1 answer

Crop out all mapped area beyond region of 13 U.S. states

I've just started with mapping in R and I've managed to convert a lat, lon dataframe to a raster file and then plot state borders on top of that. Now I need to get it ready to publish and would like to include only the shape of my 13-state region…
Nazer
  • 3,654
  • 8
  • 33
  • 47
0
votes
0 answers

How to troubleshoot mislabeling of provinces in my shapefile in r?

I have a shapefile of the Philippines that has all the correct labels of each provinces. After removing some of the provinces I won't be using, aggregating the data into a single data frame, and then attaching my covariates to the shapefile I run…
Emma
  • 31
  • 1
  • 4
0
votes
1 answer

tmap tm_bubble sizes incorrect

I am working on a map showing regional population size changes (fill color) together with share of GDP (bubble sizes) in two separate years - 1995 and 2016 using tmap package and reading it into a .png file. Everything seems to work fine except that…
tkutsar
  • 41
  • 7
0
votes
1 answer

Customise dot maps in R using tmap

I have a point dataset I would like to map. I am new to tmap and have been playing around with it, but have been unable to get the output I desire. I am after something that does the following (if possible): Display the points for a designated area…
Chris
  • 1,197
  • 9
  • 28
0
votes
1 answer

Editing defaults (popups and tiles) of tmap/leaflet/shiny

I'm creating an interactive map of the Basque Country (in Spain) using tmap, leaflet and shiny. I've been able to create the map, but I cannot edit the default behavior of renderLeaflet, specifically: I'd like to edit the default labels and popups.…
Ainhoa
  • 191
  • 7
0
votes
0 answers

Adjusting legend size in tmap

I would like to control the legend size of a continuous legend in tmap. E.g. such that it is at the bottom and spanning the whole plot. I tried all the legend.outer.size etc. options which did not work Best workaround with minimal code so far…
MR_MPI-BGC
  • 265
  • 3
  • 11
0
votes
1 answer

how to display a RasterBrick with tmap in the same way as raster::plotRGB

I like CARTO's minimalist basemaps quite a lot, but I'm having trouble using them with with tmap, my preferred mapping tool. I'm probably making a stupid mistake, but I can't get the colors…
John J.
  • 1,450
  • 1
  • 13
  • 28
0
votes
1 answer

When plotting with tmap is it better to have the final SpatialPolygonsDataFrame or changes should be made within tmap options?

I have downloaded a Spatial Polygons Data Frame from gadm.org but the map is slightly outdated and the names of the regions are in Latin. I need to change the names to Cyrillic and merge some of the regions. Is this something that would be better…
novica
  • 655
  • 4
  • 11
0
votes
0 answers

Turn off tmap legend on an interactive map?

Does anyone know how to turn off the legend on an interactive tmap map without having to convert it to a leaflet object? tm_layout(legend.show = FALSE) works in plot mode but doesn't seem to do anything in view mode.
Sharon
  • 3,676
  • 3
  • 23
  • 20
0
votes
0 answers

I downloaded shapefile but merging with internal dataset based on geometry fails

Apologies as i'm a little new to GIS features within R, so any help and explanation would be very helpful! I have downloaded this shape file (Simple Feature Polygon) from source like so: fire…
Andy White
  • 81
  • 1
  • 4
0
votes
1 answer

"non-numeric argument to binary operator" error when using tmap to plot sf data

When I try to display point data using tm_symbols, I get the error message: non-numeric argument to binary operator. I have stripped my code back to try to pinpoint the problem, and of course I have searched the tmap and other documentation. Some…
Francis Barton
  • 129
  • 2
  • 16
0
votes
1 answer

Use clickEvents in shiny with tmap

You can use clickEvents for the tmap package in shiny as in this example for leaflet in shiny. However, I don't know how to acces the click events. On each click an Id is given, but where is this id linked to? See the below example where the click…
JdP
  • 714
  • 7
  • 14
0
votes
0 answers

raster::plotRGB() works, but tm_rgb() gives "error in ind[!isna] <- m2 NAs are not allowed in subscripted assignments"

I'm trying to use a large geoTIFF as a basemap for a plot. The image is available through Harvard's online library I can successfuly import it with the raster package and plot it like so: mke.raster <-…
John J.
  • 1,450
  • 1
  • 13
  • 28