-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi
I was wondering whether it is possible to have a replicable output with map_coloring
, i.e. that is constant across calls? This is particularly useful when one is trying to use testhat snapshots.
I realize that setting minimize=TRUE
avoids the call to sample()
, so that is already a workaround. Should one want more colors than the strict minimum, the output seems to change each time. Do you see an easy way to add maybe a seed
argument?
Thanks!
library(tmaptools)
packageVersion("tmap")
#> [1] '3.3.2'
packageVersion("tmaptools")
#> [1] '3.1.1'
library(tmap)
data(World)
color <- map_coloring(World, palette="Pastel2")
color2 <- map_coloring(World, palette="Pastel2")
all.equal(color, color2)
#> [1] "152 string mismatches"
color <- map_coloring(World, palette="Pastel2", minimize=TRUE)
color2 <- map_coloring(World, palette="Pastel2", minimize=TRUE)
all.equal(color, color2)
#> [1] TRUE
Metadata
Metadata
Assignees
Labels
No labels