Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfactors and dates are slow #235
Comments
|
To confirm, are you saying the issue is in the R code before the map is rendered, or the map itself becomes unresponsive? |
|
Yes, sorry. The problem occurs before the map is rendered, so probably the R code. For large data, I can't say if the map becomes unresponsive with tooltips because I killed the process before. |
|
ok. And you've only noticed this when you add the |
|
Exactly. I left the |
|
ok I can replicate the issue. I'll look into it. |
|
It seems to be related to "tooltip" being a factor. If I convert it to character or numeric then it's quick again. |
|
I think the slow-down comes from |
|
Just noticed that library(mapdeck)
N <- 2e4
data <- data.frame(
longitude = runif(N, -180, 180),
latitude = runif(N, -180, 180),
tooltip = sample(LETTERS, N, replace = TRUE),
date = Sys.Date(),
date_txt = as.character(Sys.Date())
)
system.time(
mapdeck() %>%
add_scatterplot(
data = data,
lon = "longitude",
lat = "latitude",
fill_colour = "tooltip",
tooltip = "date"
)
)
#> user system elapsed
#> 344.012 0.000 343.854
system.time(
mapdeck() %>%
add_scatterplot(
data = data,
lon = "longitude",
lat = "latitude",
fill_colour = "tooltip",
tooltip = "date_txt"
)
)
#> user system elapsed
#> 0.076 0.000 0.077 |
|
yep. This is not strictly related to the |
|
Currently on a branch, but I think I've found the slowness N <- 2e4
data <- data.frame(
longitude = runif(N, -180, 180),
latitude = runif(N, -180, 180),
tooltip = sample(LETTERS, N, replace = TRUE),
date = Sys.Date(),
date_txt = as.character(Sys.Date())
)
system.time(
mapdeck() %>%
add_scatterplot(
data = data,
lon = "longitude",
lat = "latitude",
fill_colour = "tooltip",
tooltip = "date"
)
)
# user system elapsed
# 0.092 0.006 0.098
system.time(
mapdeck() %>%
add_scatterplot(
data = data,
lon = "longitude",
lat = "latitude",
fill_colour = "tooltip",
tooltip = "date_txt"
)
)
# user system elapsed
# 0.065 0.004 0.069 |
|
If you update the dependencies, then mapdeck, you should now see the improvements devtools::install_github("SymbolixAU/jsonify")
devtools::install_github("SymbolixAU/spatialwidget")
devtools::install_github("SymbolixAU/mapdeck") |
|
Thanks, indeed it is a dramatic improvement! |
I'm experimenting with large datasets in
mapdeckand it's amazingly smooth. Thanks for that! However, it seems that adding atooltipto a large number of points really slows down the map rendering. RStudio becomes completly unreactive ifNincreases.Created on 2019-11-08 by the reprex package (v0.2.1)
Session info
I experimented a bit and apparently time is growing exponentially.