Printing with Leaflet

Sorry if I sound new. I have been using Rstudio and Leaflet for a little while but am mostly self taught. I am running into a problem when it comes to printing my map after I export it to HTML. For some reason it keeps resetting my Layer Control to the top option but still keeps the updated layer. I will show my coding for both the print plugin I am using as well as the layercontrol as I dont know where the issue is.

I am using as a plugin. I bring it in as an HTML dependency with the following code

registerPlugin(printPlugin) %>%


"function(el, x) {


sizeModes: ['A4Landscape'],

filename: 'mymap',

position: 'bottomleft',

exportOnly: false,

hideControlContainer: false,

}).addTo(this);}") %>%

My layer control is

addLayersControl( baseGroups = c("P 12 Month","P 36 Month","P YTD",

"R 12 Month","R 36 Month","R YTD"),

position = c("bottomleft"),

options = layersControlOptions(collapsed = FALSE)) %>%

Each layer displays a different heatmap along with different labels. I can select "R 36 Month" and the layer will update but when I go to print the map will show the heatmap and markers for "R 36 Month" but the LayerControl will change back to "P 12 Month" instead of showing the "R 36 Month" that was selected.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.