We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I create a map using add_grid, and I can see the legend in the viewer of R-studio but when I save it as html, the legend disappears.
Here is my code:
bb <- mapdeck(token = key,pitch = 20, location = c(12.8262, 56.049), # middle point of Helsongborg map # location = c(12.8262, 56.040), for pitch 30 zoom = 10.4, style = mapdeck_style('streets') ) %>% add_polygon( # adding shape layer data = chi_shape ,fill_colour = "#49fc0350" , stroke_colour = "#340163" , stroke_width = 100 ,update_view = FALSE ) %>% add_grid(data = as.data.frame(res3), lat = "lon", lon = "lat", elevation = "p_tonns", elevation_scale = 4, cell_size = 500, elevation_function = "max", colour_function = "max", colour = "p_tonns", layer_id = "tree", extruded = T, legend = T, legend_options = list(title="Tons"), update_view = F) %>% add_title(title = paste0(i,", production by zone (tons)")) file_html <- "file name" saveWidget(bb, file_html)
I also tried to save html using mapshot but the result is the same.
So then I get this map in the viewer:
But when I open it in Chrome or Edge, I get this:
zooming-in / out or moving the map does not help, still no legend.
When I open Chrome console, there is no error, and it has the legend container:
In the same script I create another map using add_line, and in that case the legend works
I use mapdeck_0.3.4 R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)
The text was updated successfully, but these errors were encountered:
Reprodicible example
library(mapdeck) set_token(secret::get_secret("MAPBOX")) df <- read.csv(paste0( 'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/', 'examples/3d-heatmap/heatmap-data.csv' )) df <- df[ !is.na(df$lng ), ] mapdeck( style = mapdeck_style("dark"), pitch = 45 ) %>% add_grid( data = df , lat = "lat" , lon = "lng" , cell_size = 5000 , elevation_scale = 50 , layer_id = "grid_layer" , auto_highlight = TRUE , legend = T )
Sorry, something went wrong.
I've no idea why this happens. It looks like the .legendContent isn't being kept when exporting from RStudio to the browser. But I don't know why.
.legendContent
No branches or pull requests
Hi,
I create a map using add_grid, and I can see the legend in the viewer of R-studio but when I save it as html, the legend disappears.
Here is my code:
I also tried to save html using mapshot but the result is the same.
So then I get this map in the viewer:
![image](https://user-images.githubusercontent.com/4821597/169251468-3abd5382-5383-4662-8edc-d4ed145d84de.png)
But when I open it in Chrome or Edge, I get this:
![image](https://user-images.githubusercontent.com/4821597/169250001-24ec9080-4ccd-4c47-ba9d-f430747055f7.png)
zooming-in / out or moving the map does not help, still no legend.
When I open Chrome console, there is no error, and it has the legend container:
![image](https://user-images.githubusercontent.com/4821597/169250676-d306890a-f2ff-42a8-b418-5b4cb4ef3e7e.png)
In the same script I create another map using add_line, and in that case the legend works
I use
mapdeck_0.3.4
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
The text was updated successfully, but these errors were encountered: