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

How to manipulate tmap legend?

I'm creating a thematic map of percent change per year for bird species. here is the code I have: tm_shape(grid83)+ tm_fill("trend", title = "Percent change per Year", textNA = "None counted", style="fixed", breaks=c(-Inf, -1.5, -0.25, 0.25,…
wallflower
  • 437
  • 1
  • 5
  • 9
16
votes
1 answer

Error in CPL_transform(x, crs, aoi, pipeline, reverse): OGRCreateCoordinateTransformation() returned NULL: PROJ available?

I am using ubuntu 18.04 and the following code is generating an error library(sf) library(tmap) library(dplyr) library(raster) #sudo apt install…
David Hammond
  • 161
  • 1
  • 3
11
votes
1 answer

How do you position the title and legend in tmap?

I am new to programming and am currently enrolled in an introductory spatial analysis course which uses R. The following code yields the tmaps included below. How can I center the title for each tmap as well as position the legend on the top right…
Hubmeister
  • 113
  • 1
  • 1
  • 5
11
votes
3 answers

How to add a basemap to a tmap plot in R?

I'm wondering whether it is possible to add a basemap to a map made in tmap when the tmap mode is set to plot and not interactive mode. This is the code I have used to produce my map library(sf) library(spData) library(tmap) tm_shape(nz) + …
T.2001
  • 147
  • 1
  • 6
9
votes
1 answer

how to export tm object without chart borders

I am trying to plot a map without the 'box border' around it. Does anybody know how to work around the tmap package to not print the 'outer box border'? - not to be confused with tm_borders as it is a segment plotting the border of the polygons in…
gemkeeper
  • 125
  • 2
  • 6
9
votes
6 answers

ggplot/mapping US counties — problems with visualization shapes in R

So I have a data frame in R called obesity_map which basically gives me the state, county, and obesity rate per county. It looks more or less like this: obesity_map = data.frame(state, county, obesity_rate) I'm trying to visualize this on the map…
user3648073
  • 91
  • 1
  • 1
  • 3
8
votes
3 answers

How to create animation of vehicle moving form A to B along a route?

below is an example of finding route, travel time and travel distance from 'One World Trade Center, NYC' to 'Madison Square Park, NYC' using osrm package in R. (I learnt it from Road Routing in R). The travel time here is 10.37 minutes. I wanted to…
SiH
  • 1,378
  • 4
  • 18
8
votes
2 answers

Saving a tmap with a basemap as an image?

I have created a map in R using tmap, with a basemap, and want to save it as an image. Whenever I use tmap_save to save it as a .png, I lose the basemap. Presumably, this is because the basemap is not visible in plot mode and only in view mode. Is…
user10310704
  • 103
  • 1
  • 4
8
votes
1 answer

How can I share legend for multiple maps in tmap?

Running example code from tmap library: library("tmap") tmap_mode("plot") data(NLD_muni) tm_shape(NLD_muni) + tm_borders() + tm_bubbles(size = c("origin_native", "origin_non_west"), legend.size.is.portrait = TRUE) Gives me following map All…
radek
  • 7,240
  • 8
  • 58
  • 83
8
votes
2 answers

R tmap, legend formatting - display single value in the first legend key

I'm not sure how or if is possible to adjust the key legends in the fallowing way. Consider the example: library(tmap) data(Europe) my_map <- tm_shape(Europe) + tm_polygons("well_being", textNA="Non-European countries", title="Well-Being…
Valentin_Ștefan
  • 6,130
  • 2
  • 45
  • 68
8
votes
2 answers

plotting shape file in ggplot2

I'm trying to figure out how to display my complete map in gglot2 including the island Both r_base and tmap were able to display the islands but ggplot2 couldn't differentiate the island from the rest of the waterbody... . My question is how to…
Hammao
  • 801
  • 1
  • 9
  • 28
7
votes
2 answers

Manipulating "missing" label in legend: tmap

I want to manipulate the "Missing" label in my legend. I'm using the tmap function in R. I want to change it to read "Missing or not eligible to gentrify" I have tried using the tm_text function and considered how I would change the label in the…
kaseyzapatka
  • 149
  • 2
  • 9
7
votes
2 answers

Adding text labels to tmap plot

I'm trying to add some text labels a tmap plot. library(tmap) library(raster) jnk <- getData("GADM",country="IND",level=2) map_file <- tm_shape(jnk) + tm_polygons() + tm_text("NAME_1", remove.overlap = TRUE) My problem is I'm getting…
in123321
  • 73
  • 1
  • 4
7
votes
1 answer

How to manually set colour of dots in R using tmap

I'm trying to create a map showing the location of wells based on some defined categories. I have categorized each well's water level relative to their full record, categorizing the water levels into terms "Highest-ever", "above-normal", "normal",…
Simon
  • 295
  • 1
  • 4
  • 12
7
votes
1 answer

tmap R - change font for title of thematic plot from plain to italics but keep font of the legend plain

I would like to change the font for the main title of a thematic plot using the tmap package in R from 'plain' to italics but keep the font for the legend heading and text 'plain'. However, when I change the argument fontface in the lm_layout()…
sjarvie
  • 71
  • 1
  • 3
1
2 3
32 33