Skip to content

Instantly share code, notes, and snippets.

@nlddfn
Created August 7, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlddfn/b65e2a45925b8d58f0ef2870491ff7c1 to your computer and use it in GitHub Desktop.
Save nlddfn/b65e2a45925b8d58f0ef2870491ff7c1 to your computer and use it in GitHub Desktop.
Shiny_Migration_path
# Create Map
output$map <- renderPlotly({
sel.data <- filter(balkanRoute.map, Date == input$slider.map)
# light grey boundaries
l <- list(color = toRGB("grey"), width = 0.5)
# specify map projection/options
g <- list(
scope='world',
projection=list(scale = 1),
showframe = T,
showcoastlines = T,
projection = list(type = 'Mercator'),
lataxis = list(range = c(30,50)),
lonaxis = list(range = c(-10,40)),
showsubunits = T,
showcountries = T
)
plot_ly(sel.data, z = Arrivals, text = Country, locations = Code, type = 'choropleth',
color = Arrivals, colors = 'Blues', marker = list(line = l),inherit = FALSE,
colorbar = list(title = 'Arrivals')) %>%
add_trace(.,type="scattergeo",
locations = country_codes$Code, text = country_codes$Country, mode="text") %>%
layout(title ='Daily arrivals across the Balkans', geo = g, width = "100%")
})
# Plot time series
output$arrivals_by_day <- renderDygraph({
dygraph(balkanTimeSeries) %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = FALSE) %>%
dyRangeSelector() %>%
dyRoller(rollPeriod = 7)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment