Etykiety i wyskakujące okna

Interaktywne mapy z leaflet w R

Rich Majerus

Vice President of Strategy & Planning, Queens University of Charlotte

Potokowanie i operator ~

ipeds %>% 
 leaflet() %>% 
 addProviderTiles("CartoDB") %>% 
 addCircleMarkers(
               lng = ~lng, 
               lat = ~lat, 
               popup = ~name, 
               color = "#FF0000")

Markery kołowe wszystkich uczelni 1

# ipeds is specified 3 times
leaflet() %>% 
  addProviderTiles("CartoDB") %>% 
  addCircleMarkers(
              lng = ipeds$lng, 
              lat = ipeds$lat, 
              popup = ipeds$name, 
              color = "red")

Markery kołowe wszystkich uczelni 2

Interaktywne mapy z leaflet w R

Wszystkie kolory

ipeds %>% 
     leaflet() %>% 
     addProviderTiles("CartoDB")%>% 
     addCircleMarkers(
        lng = ~lng, lat = ~lat, 
        popup = ~name,color = "#FF0000")
Hex Dziesiętny Kolor RGB
FF 255 Czerwony
00 0 Zielony
00 0 Niebieski

Hex FF0000

= 16^1*15 + 16^0*15

= 16*15 + 1*15

= 240 + 15

= 255

Interaktywne mapy z leaflet w R

Tworzenie lepszego wyskakującego okna

addCircleMarkers(popup = ~name)

addCircleMarkers(popup = ~paste0(name, "-", sector_label)
addCircleMarkers(popup = ~paste0("<b>",name,"</b>"," <br/>",sector_label))

Niestandardowe wyskakujące okna

Interaktywne mapy z leaflet w R

Etykiety

ipeds %>% 
    leaflet()  %>% 
    addProviderTiles("CartoDB")  %>% 
    addCircleMarkers(label = ~name, radius = 2)

Niestandardowe etykiety

Interaktywne mapy z leaflet w R

Czas na ćwiczenia!

Interaktywne mapy z leaflet w R

Preparing Video For Download...