在传单R-Map中防止缩小?

Mar*_*ise 13 r zoom leaflet

我用传单R-package制作了传单地图.

这就是结果: 在此输入图像描述

我很高兴,但是当我将它嵌入网站并用我的笔记本电脑向下滚动文章时,我经常会不小心缩小地图,然后看起来像这样:

在此输入图像描述

用户必须放大,看看地图的间隙部分,这真的让我烦恼.

有没有办法冻结地图的一部分,就像你可以像往常一样放大,但不能缩小比图像更像?我尝试在我的代码中设置View但你仍然可以缩小,所以我删除了那部分.

    mymap <- leaflet() %>% 

addProviderTiles("Esri.WorldGrayCanvas") %>%
addPolygons(data = dortmund, 
            fillColor = ~palette(student1$Anteil),  ## we want the polygon filled with 
            ## one of the palette-colors
            ## according to the value in student1$Anteil
            fillOpacity = 0.6,         ## how transparent do you want the polygon to be?
            color = "darkgrey",       ## color of borders between districts
            weight = 1.5,            ## width of borders
            popup = popup1,         ## which popup?
            group="<span style='color: #7f0000; font-size: 11pt'><strong>2000</strong></span>")%>%  
            ## which group?
            ## the group's name has to be the same as later in "baseGroups", where we define 
            ## the groups for the Layerscontrol. Because for this layer I wanted a specific 
            ## color and size, the group name includes some font arguments.  

## for the second layer we mix things up a little bit, so you'll see the difference in the map!
addPolygons(data = dortmund, 
            fillColor = ~palette(student2$Anteil), 
            fillOpacity = 0.2, 
            color = "white", 
            weight = 2.0, 
            popup = popup2, 
            group="2014")%>%
addLayersControl(
    baseGroups = c("<span style='color: #7f0000; font-size: 11pt'><strong>2000</strong></span>", ## group 1
                   "2014" ## group 2
    ),
    options = layersControlOptions(collapsed = FALSE))%>% ## we want our control to be seen right away
addLegend(position = 'topleft', ## choose bottomleft, bottomright, topleft or topright
           colors = c('#fee0d2',
                      '#fcbba1',
                      '#fc9272',
                      '#fb6a4a',
                      '#ef3b2c',
                      '#cb181d',
                      '#a50f15',
                      '#67000d'), 
           labels = c('0%',"","","","","","",'26%'),  ## legend labels (only min and max)
           opacity = 0.6,      ##transparency 
           title = "relative<br>amount")   ## title of the legend
Run Code Online (Sandbox Code Playgroud)

原谅我糟糕的英语技巧.如果回答我的问题很重要,那么完整的代码就在这里:http://journocode.com/2016/01/28/your-first-choropleth-map/.

非常感谢你

小智 13

用以下内容替换你的addProviderTiles(设置你想要的最大和最小缩放级别:

addProviderTiles("Esri.WorldGrayCanvas",
        options = providerTileOptions(minZoom=10, maxZoom=18))
Run Code Online (Sandbox Code Playgroud)