Open davidshumway opened 3 years ago
Hi @davidshumway sorry for the long silence. This has been a behaviour of mapview for a long time. Basically, we calculate the mean luminence of the supplied layer(s) and then decide whether we show the light or the dark background map to facilitate better contrast. You are right that this does not make sense if the user supplies their own set of basemaps. I've now introduced an option to control this. See below for an example:
library(mapview)
mapviewOptions(vector.palette = colorRampPalette(c("#fee8c8", "#fee8c8", "#fee8c8")))
mapview(franconia, zcol = "district")
mapviewOptions(basemaps.color.shuffle = FALSE)
mapview(franconia, zcol = "district")
Created on 2021-06-04 by the reprex package (v2.0.0)
Does this solve your issue?
In the following, the basemap is automatically switched to DarkMatter. How to avoid this?
If I get rid of DarkMatter, then it's automatically switching to OpenStreetMap, e.g.
I'd like to have all the default options available but basemap is CartoDB.Positron.
Update: It's apparently switching automatically away from Positron only when 1) the data that I've added to the map is very lightly colored and there's one small hotspot, and 2) the color scheme is a certain color (using sequential with 9 colors and choosing three from the list via colorbrewer2.org). For example, assume there are 100 census blocks rendered and one block has a zcol value of 3000, while the rest of the blocks are in the range of 0-200. In this case, the basemap is automatically switching away from Positron. If there are a lot of dark colors, e.g., a lot of zcol = 3000, then the basemap stays with Positron. But with my present data set, almost all data is low valued with only a few census blocks in a high value range (i.e. the map almost always changes away from Positron!). Some of the sequential color schemes appear to not knock Positron out of place (a blue scheme and a pink scheme one) but the one above c("#fee8c8", "#fc8d59", "#7f0000") does so.