2016-02-22 100 views
11

Tôi đã tạo một bản đồ tờ rơi với gói R tờ rơi.Tránh thu nhỏ trong tờ rơi R-Map?

Đây là những gì kết quả trông giống như: enter image description here

Tôi rất hài lòng với nó, nhưng khi tôi nhúng nó vào một trang web và di chuyển xuống các bài viết với máy tính xách tay của tôi, tôi thường vô tình thu nhỏ của bản đồ mà sau đó trông như thế này:

enter image description here

người dùng phải zoom lại trong quá có một cái nhìn ở phần intersteing của bản đồ mà thực sự làm phiền tôi.

Có cách nào để cố định phần bản đồ như bạn có thể phóng to như thường lệ nhưng không thể thu nhỏ nhiều hơn như trên hình ảnh không? Tôi đã thử đặt Chế độ xem trong mã của mình nhưng bạn vẫn có thể thu nhỏ để tôi xóa phần đó.

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 

Tha thứ kỹ năng tiếng Anh xấu của tôi. Nếu điều quan trọng là trả lời câu hỏi của tôi, mã đầy đủ ở đây: http://journocode.com/2016/01/28/your-first-choropleth-map/.

Thank you very much

Trả lời

9

Thay addProviderTiles của bạn như sau (thiết lập bất cứ mức thu phóng mà bạn muốn cho max và min:

addProviderTiles("Esri.WorldGrayCanvas", 
     options = providerTileOptions(minZoom=10, maxZoom=18)) 
+1

Cảm ơn bạn rất rất nhiều Đối với tôi nó làm việc với 'addProviderTiles ("Esri.WorldGrayCanvas", options = tileOptions (minZoom = 10, maxZoom = 16))} ' –

Các vấn đề liên quan