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
2 answers

Adding data/values to shp produces error. Whats wrong?

I'm trying to use library(tmap) to color regions after some value (like income). I have a shp-file for Sweden and some incomedata in a xlsx-file. First I import the data: map <- readOGR("Kommun_RT90_region.shp", encoding = "UTF-8") kapital_kommun <-…
Tomas R
  • 440
  • 2
  • 10
0
votes
2 answers

Formatting line breaks when using superscripts in tmap legend

I am trying to create a map with the tmap showing the population density. Therefore, I want the legend title of the map to be "Population density in n\ [people per km^2]". This map is the closest I have gotten to my desired final result. Now, as you…
0
votes
1 answer

tmap legend outside title font size adjusting

It 's not a reprex. I have maps with very long titles. I put my legend them outside. The font size is very small and I can't control it. The argument title.size = 2 is not working. map_cp <- tm_shape(choro) + tm_polygons(col = "taux", style…
Wilcar
  • 2,349
  • 2
  • 21
  • 48
0
votes
1 answer

R: Remove island in a tmap map

I am trying of remove islands using tmap. Frequently I use lims to remove islands in ggplot: library(tmap) library(ggplot2) library(raster) chile <- getData("GADM",country="Chile",level=1) ggplot()+ geom_polygon(data=chile, aes(x=long, y=lat,…
Rodrigo_BC
  • 161
  • 11
0
votes
1 answer

Specifying colors in tmap for different classes R

I am trying to create a map that shows diverging values. I tried to set the breaks but somehow the different classes don't show different colours (click here for the map). The output map always has the same colour for several classes.…
0
votes
1 answer

R: projection robin in tmap

I am trying to create map with projection "robin", but I get an error: library(sp) library(tmap) data(World) tm_shape(World, projection = "robin")+tm_borders()+tm_fill(col = 'pop_est_dens')+tm_grid(n.x = 11, n.y = 11) Error in…
Mikołaj
  • 385
  • 4
  • 17
0
votes
1 answer

Issues plotting spatial point data using tmap

I have created a class Large SpatialPointDataFrame from a csv file, and I am trying to plot the data points using tmap. When I plotted the SpatialPointDataFrame using plot(), everything looked fine. However, when I tried to plot it using tmap, it…
0
votes
1 answer

Error in tmap_save: object 'tm' not found

When I try to save my plot as an HTML file, I got this error: Error in `+.tmap`(e1 = tm, e2 = do.call("tm_layout", args)) : object 'tm' not found Here is my code: tm_shape(countries_spdf) + tm_grid(n.x = 11, n.y = 11) + tm_fill(col =…
Yuhan Wang
  • 11
  • 1
0
votes
1 answer

(tmap package in R) Filtering values within tm_text

I want to display tm_text options based on a filter of a data. Take the following example: tm_shape(World) + tm_polygons("HPI") + tm_text("name", size = "AREA") This displays text for every feature. But let's say I only wanted to display text for…
nd37255
  • 248
  • 1
  • 9
0
votes
1 answer

Creating a gif map with r using a shape file

I have a data frame which looks like this ZIPCODE Geometry 2020 2019 2018 2017 2016 2015 10000 shapefileinfo1 x1 x2 x3 x4 x5 x6 10001 shapefileinfo2 y1 y2 y3 y4 y5 y6 10002 shapefileinfo3 z1 z2 z3 z4…
user12913064
0
votes
1 answer

Invalid geometries for map made in Tmap

I'm having trouble with one of the maps I'm making for a report. I know the problem, but don't know how to fix it. Four polygons in my shape file are not valid--they are Ring Self-Intersecting. The shape file is for the New York metro area. When I…
kaseyzapatka
  • 149
  • 2
  • 9
0
votes
1 answer

How can I generate a due date considering a work schedule from a initial date?

Example Due time is 15min Schedule Mon - Fri: 7:30 - 17:00 Sat 9:00 - 14:00 Sun 10:00 - 13:00 If my initial date(IniDate) is Monday at 6:00 the due date is going to be Monday at 7:45 and if my IniDate is Monday at 8:00 my due date is going to be…
0
votes
1 answer

How to fix incorrect automatic labels on a map (tmap)

I have a point shapefile with cities (CitiesPoints), and a dataframe that assigns a number of libraries to some of those cities (df; the data is fictitious). I also have a polygon shapefile for the background. I joined those files to create a map in…
Natalias
  • 179
  • 6
0
votes
1 answer

How to get from tmap the latitude longitude of each x,y point on the World map?

With the library tmap, a map can be plotted of the world coastlines and borders: library(tmap) data("World") tm_shape(World) + tm_borders() Is it possible to get the latitude longitude of each x,y point on the map that is used to draw coastlines…
0
votes
1 answer

Problem installing tmap r package ubuntu 18.04

I get the following error: * installing *source* package ‘lwgeom’ ... ** package ‘lwgeom’ successfully unpacked and MD5 sums checked ** using staged installation configure: CC: gcc -std=gnu99 configure: CXX: g++ -std=gnu++11 configure: pkg-config…
Nicolas Molano
  • 693
  • 4
  • 15