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
2
votes
1 answer

Using tmap in R shows black background for masked RGB raster

I'm attempting to create a map in R using library(tmap) with a full-color RGB, masked Landsat image. The NAs however appear as black. Here's what I did. Using library(sf) I calculated the centroids of 5 polygons and buffered them by 5000m. Following…
kit444
  • 21
  • 3
2
votes
1 answer

R - Plot with tmap() does not display the legend

I use the tmap package. I plot a map with the qtm() function but the legend is not displayed. Indeed, I understand that the legend is automatically display, unless you specify to hide it. I also try to use a work-around with the tm_add_legend() but…
Kumpelka
  • 869
  • 3
  • 11
  • 33
2
votes
1 answer

tmap: Unsightly white borders Mac/Rstudio

When doing this: library(tmap) data("Europe") tm_shape(Europe)+ tm_polygons(col="black",lwd = NA) I'm getting unsightly white borders with tmap. Tried tm_fill and tm_polygons. And also border.col=NA or lwd=0. This happens in RStudio as well when…
Severin
  • 21
  • 2
2
votes
3 answers

How to remove last character of last row in tmap using Talend?

I am extracting two columns using textractjson and passing it to a tmap component where I am concatenating both of the columns as single one. Also, I want a comma at the end of each row except the last row. I am not sure how to do…
2
votes
1 answer

R: tmap Legend Formatting

I am trying to create a function to map different variables for a specific state's school districts. However I a running into some problems formatting the legend. At the moment I have it laid out the best way to fit the maps(horizontally), but some…
Cyan0121
  • 31
  • 1
  • 3
2
votes
1 answer

How to output a tmap_leaflet in Rshiny

So I'm new to Rshiny and R in general. I was testing out the tmap package and when I typed this into the console > working_map <- readOGR(dsn=".",layer=file_name, GDAL1_integer64_policy=TRUE) > japan <- tm_shape(working_map) + tm_fill(col="NumIB",…
qpisqp
  • 51
  • 5
2
votes
2 answers

R: Mapping positive and negative numbers with different colors

I'm a journalist working to map the counties where the number of black farmers increased or decreased between 2002 and 2012. I am using R (3.2.3) to process and map the data. I've been able to map the whole range of county-level gains and…
J. Trimarco
  • 149
  • 1
  • 8
2
votes
1 answer

Disable Rstudio viewer

I am working with the tmap package and want to produce leaflet maps (with tmap_mode("view")). Rstudio crashes quite often when I try this. How can I force Rstudio (or only the "plotting" function) to display the output rather in the browser than in…
Alex
  • 4,925
  • 2
  • 32
  • 48
1
vote
3 answers

Plot two counties side by side while preserving scale

Is there a way to plot the two counties side by side (without changing actual scale) to compare their sizes. I wish to plot San Diego and Santa Clara side by side to demonstrate their actual size. Thanks library(tigris) library(ggplot2) san_diego…
SiH
  • 1,378
  • 4
  • 18
1
vote
1 answer

How to make a frame around titles in R?

I am making plots using the tmap package. I was wondering if I could draw a frame around each plot's title. I looked into tm_layout function and did not manage to find anything relevant. The below is my code. When you run this code, you will get the…
Phil
  • 37
  • 5
1
vote
1 answer

Is there a way to use one border for each created group in tmap R?

I'm trying to replicate this map: Unfortunately there aren't any available shapefiles for those regions, but I do know the provinces in each group. When I run this code, I get: x <- c("ggmap", "rgdal", "maptools", "dplyr", "tidyr", "tmap",…
almr27
  • 43
  • 4
1
vote
0 answers

Transforming geos_geomtries to sf geometries raises error (Error: Not compatible with STRSXP: [type=NULL])

I've been experimenting with data.table + geos (see https://grantmcdermott.com/fast-geospatial-datatable-geos/ for the example I followed), but I've had issues converting the data.table+geos object back to sf (for mapping with tmap, for example). In…
vinceroni
  • 87
  • 5
1
vote
1 answer

Highlight selected data table entries on interactive map in r shiny

I am creating an application using r shiny where a user can add public fruit tree locations to a map. I would like to make is so that a user can select an entry in the data table ( made with DT package) and have it appear highlighted on the…
1
vote
1 answer

Add location to interactive map with a click using tmap package and r shiny

I am creating a shiny application that displays locations of public fruit trees around Bellingham, WA. So far I have made it so users can input lat/long coords and tree type and plot the location on the map. eventually I would like to make it so…
1
vote
1 answer

Why tmap invokes R device in t_map_mode("view")

I am trying tmap for the first time and while making some maps on "view" mode the R graphics device pops up everytime I attempt to make an interactive plot. For instance: library(tmap) library(mapview) data(World) # just the…
Salvador
  • 1,229
  • 1
  • 11
  • 19