-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
factors 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
mapdeck
and it's amazingly smooth. Thanks for that! However, it seems that adding atooltip
to a large number of points really slows down the map rendering. RStudio becomes completly unreactive ifN
increases.Created on 2019-11-08 by the reprex package (v0.2.1)
Session info
I experimented a bit and apparently time is growing exponentially.
The text was updated successfully, but these errors were encountered: