tmap
tmap copied to clipboard
tmap4: to do list (in order of priority)
- [x]
tmap_save
(easy) - [x]
tmap_animation
(easy) - [x]
tm_add_legend()
(easy) - [x] fix multivariate variables
tm_mv
, also needed fortm_rgb
(#712) (hard) - [x]
tm_title()
andtm_main_title
(easy) - [x]
tm_xlab
andtm_ylab
(easy) - [x] finish
qtm
(easy but some work) #864 - [ ]
tmaptools
update (egbb
) (easy + lot of work) - [x]
tmapProxy
for shiny apps (hard) - [x] tmap charts (histograms etc) (#725)
- [x] insets (hard) (#658)
- [x] tm_iso, automatic text labeling
- [x] tmapOutput and renderTmap
This list is in order of priority (highest at the top). Suggestions are welcome.
(see also #599 and https://github.com/r-tmap/tmap/issues/694#issuecomment-1459693666)
From the geocompr point of view, I would say that the most important are: tmap_save()
, tmap_animation()
, and tmap_add_legend()
. Then tm_rgb()
, tm_title()
/tm_main_title()
, and tm_xlab()
/tm_ylab()
tmap_save
migrated, basic functionality is working. Have to reimplement insets though, which is hard and a lot of work (see #658 for ideas).
For geocompr
as long as the intention is for the code to eventually all work with tmap v4+ that's OK by me if we add a footnote. Would be awesome if it's feature complete according to this branch, the CI tests of which are currently failing: https://github.com/geocompx/geocompr/pull/953/
For
geocompr
as long as the intention is for the code to eventually all work with tmap v4+ that's OK by me if we add a footnote. Would be awesome if it's feature complete according to this branch, the CI tests of which are currently failing: geocompx/geocompr#953
Not sure why CI is failing. It states 'could not find function "get_pch_names"', but this function exists, so perhaps CI is checking al older version of tmap?
@mtennekes tmap_animation()
seems to be working fine.
I also have a question about it. When using pages = "year"
, the panel names are not included (see the attached code). Thus, to recreate the figure https://r.geocompx.org/adv-map.html#fig:urban-animated, am I forced to use by = "year", nrow = 1, ncol = 1
or is there a better way?
Answer: tm_facets_pagewise
library(sf)
library(dplyr)
library(spData)
library(tmap)
world2 = filter(world, continent != "Antarctica")
m_save = tm_shape(world2) +
tm_polygons() +
tm_shape(urban_agglomerations) +
tm_symbols(size = "population_millions",
size.legend = tm_legend(title = "Population (m)"),
fill = "red", fill_alpha = 0.5) +
tm_facets(pages = "year", as.layers = TRUE, free.coords = FALSE)
tmap:::tmap_animation(tm = m_save, filename = "/tmp/urban-animated.gif", width = 1200, height = 800)
Another function that could be useful to reinstate is tm_iso()
Are there plans to reinstate shiny-related functions? renderTmap()
and tmapOutput()
? If not, what replacements should be suggested to users?
Those are I think the remaining (but difficult) hurdles because tmap4 is CRAN ready. List updated.
@mtennekes, there are still a few issues that I am aware of.
- https://r-tmap.github.io/tmap/reference/v4-not-yet.html?q=tm_log#ref-usage.
Everything that is not reimplemented should propose something to users to replace with.
This example was still failing last time I checked. https://github.com/r-tmap/tmap/commit/010201591e55783a961a99c3a200e537af1d2a35
tm_shape(World) +
tm_polygons(c("income_grp", "economy"), title = c("Legend Title 1", "Legend Title 2")) +
tm_layout(main.title = "Main Title",
main.title.position = "center",
main.title.color = "blue",
title = c("Title 1", "Title 2"),
title.color = "red",
panel.labels = c("Panel Label 1", "Panel Label 2"),
panel.label.color = "purple",
legend.text.color = "brown")
There are a few in examples/tm_layout.R as well that should be checked out.
Also, about tmap reverse dependencies, have you checked if they work with tmap v4? I'd be happy to help provide PRs for the failing ones.
https://github.com/r-lib/revdepcheck
Thanks @olivroy there are probably still tons of (small) issues like these.
In your example, we need to split the scale/legend arguments (e.g. title) like this:
tm_shape(World) +
tm_polygons(c("income_grp", "economy"),
fill.legend = list(tm_legend(title = "Legend Title 1"),
tm_legend(title = "Legend Title 2")))
Apart from that, the tm_layout
part works as expected, except for the main.title
. Somehow the outside-margins are ignored:
tm_shape(World) +
tm_polygons(c("income_grp", "economy"))+
tm_title("Main", position = tm_pos_out("left", "top"))
Have to fix that.
What kind of PRs are you suggesting, @olivroy ?
What kind of PRs are you suggesting?
I am thinking of submitting PRs to tmap reverse dependencies that may fail due to tmap v4 if it is necessary.
I think that checking reverse dependencies is something useful to see if tmap v4 still has many outsranding issues or not.