r-tmap / tmap

R package for thematic maps
https://r-tmap.github.io/tmap
GNU General Public License v3.0
856 stars 119 forks source link

qtm #864

Open mtennekes opened 5 months ago

mtennekes commented 5 months ago

qtm is quite hard to reimplement due to backward compatibility. In v3 there were trillions of arguments that could be passed on, and also in v4, so quite complex to get it right.

Related to #861 : I'm not aiming for exact code translation (which is hard) but low level learning tips, that I think is also more useful from an educational point of view.

This one from #851 is working well:

qtm(World, borders = NULL) + 
    qtm(metro, symbols.size = "pop2010", 
        symbols.title.size= "Metropolitan Areas", 
        symbols.id= "name",
        format = "World")

This to do's for qtm : facets and baseman's.

Please use this issue to post examples of qtm that don't work as expected or that give a different result than in v3.

nickbearman commented 2 months ago

I'm not sure on the threshold for a "different result". I include an example below. If it's not "different" then please say so! This is for a point dataset with the qtm() defaults:

v3 image

v4 image

crimes <- read.csv("http://nickbearman.me.uk/data/r/police-uk-2020-04-merseyside-street.csv") crimes_sf <- st_as_sf(crimes, coords = c('Longitude', 'Latitude'), crs = 4326) qtm(crimes_sf)

mtennekes commented 2 months ago

Thanks for bringing this up @nickbearman

Apparently, the spatial points are treated like bubbles (v4) instead of dots (v3) by qtm. Not sure what the reason was, and I can change it back.

Apart from backward compatibility, what do you like more / find more useful? In your example, the dots work better, but what if there are only a handful of points?

nickbearman commented 3 weeks ago

Thanks @mtennekes

Good question. I think ideally if there are a small number of items then use bubbles, where as if there are a large number of items use dots. This would probably provide the best user experience, but I appreciate it makes qtm() more complicated and you may not want this!

For info, my example above had 13,650 observations in it.

So perhaps <250 use bubbles, otherwise use dots might be a good approach?

Thanks for all the work your doing!