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
1
vote
1 answer

How to change the border color of a polygon based on an attribute value in R tmap

I am trying to create a map using R's tmap package that has a different color outline for each value of an attribute. When filling the polygons, for example, I can simply do tm_polygons(col = "variable") to get a map that fills the polygons based on…
z_11122
  • 153
  • 8
1
vote
0 answers

Creating maps with pie charts from genetic data

I am doing a population genetics study and working with chloroplast data from an oak species. I have performed a DAPC and found that there are 5 clusters of chloroplast genotypes. I want to make a map that shows the ratios of each of these based on…
1
vote
1 answer

How to include multiple layers within the same dataframe using tmap in R?

I am working with some public datasets, which can be accessed here inside the 'stack_question' folder). I am trying to create a map of all the supermarkets within the state of Kansas using the tmap library in R. Using ggplot, I generated a map using…
ihb
  • 292
  • 9
  • 27
1
vote
1 answer

Manually specify the number of legend categories in tmap, including unrepresented categories

I am trying to specify a simple legend for a map of polygons and an integer variable, in which not all values within the range are present. I need this in order to have the same legend, with the same color scale, on comparable maps which differ in…
Peter Pearman
  • 129
  • 1
  • 10
1
vote
1 answer

How to move the compass arrow and scale bar off of the plot when using tmap in R?

I am using the tmap package to plot some data on a map. Because of the size of the datasets, you can download the needed ones here (they are public datasets). This code uses the .csv and .shp files in the drive. I need to move the compass and the…
ihb
  • 292
  • 9
  • 27
1
vote
1 answer

Is there a function to set a minimum size for symbols in tmap?

when tm_bubbles or tm_symbols is used to create bubbles or dots representing my data, categorized using size="data column of my choice", I am encountering a problem, where very small numbers in my dataset (let's say n=2 and my range is 10,2000), my…
Brenda Thompson
  • 327
  • 2
  • 9
1
vote
1 answer

Is there any way to customize legend histogram x-axis or y-axis using tm_layout in R

I know that it is possible to customize some features of "legend.hist" from tm_layout such as "legend.hist.height", "legend.hist.size", "legend.hist.width" and so. However, is there some way to customize the x-axis or y-axis like for instance…
msc
  • 15
  • 2
1
vote
1 answer

How to highlight selected polygon in interactive map, made in tmap package in R?

For example, I made a simple leaflet based map using tmap package. The result is an html with interactive map, showing some polygons of buildings (find data, code and the map itself here). I want polygons to be highlighted someway when selected by…
1
vote
1 answer

Why is the legend distorted on my map using tmap?

I'm following an example from Geocomputation with R in Chapter 4, section 4.2.6. In the example from the book, the map of New Zealand that has the average elevation in the polygons/regions has a nice, compact legend that is easy to read and placed…
EastBeast
  • 89
  • 7
1
vote
1 answer

Polygons shifted north of raster even with same CRS

I am having trouble. I am unable to identify the issue when plotting a SpatialPixelDataframe and a SpatialPolygonDataframe with the same CRS in tmaps. The spatialpixels object can be found here saved as RDS, and the polygons shapefile here,…
1
vote
1 answer

How can I project a raster in lat-long coordinates to UTM, for plotting in tmap?

I have a map with an elevation raster that is in lat/long coordinates but I now need to display the map in easting/northing. How can I accomplish this? I have tried reprojecting the raster from lat/long to UTM but this warps the map (I assume for…
gregor-fausto
  • 435
  • 2
  • 9
1
vote
1 answer

Adjusting labels and breaks with tmap (tm_bubbles)

I have a data frame that looks like the following only on a much larger scale called TA_population TA_name population population_perc Buller 2376 28.59 Grey 4653 55.98 Clutha 1283 15.44 I am trying to create a Choropleth map with…
1
vote
1 answer

Interactive R Map with Search Functionality

Trying to build a very basic interactive map in R. In general I would like to do the following: Export a shapefile from ArcGIS -> Plot as interactive map in R -> Search shapefile based on attributes (e.g. Name) I have been using tmap: shapefile =…
Dan
  • 352
  • 3
  • 11
1
vote
1 answer

Is there a function to alter the legend to match the buffers I have created?

I have created 2 buffers of 250m and 500m. When I plot my data, it shows my legend as having too many Summarising population in buffers I want the legend to have 0-250, 250-500, then over 500, and missing data
1
vote
1 answer

Do zoom of a city in a map R tmap

I am working with tmaps and I'm plotting Colombia's map, which has a very small city (city == "San Andrés"). When I plot the map I have this: tm_shape(mapa_municipal) + tm_borders ()+ tm_polygons("Ganador_20181V") I have seen in some pages…
Andres Gonzalez
  • 219
  • 1
  • 8