Skip to content

Instantly share code, notes, and snippets.

@sjstebbins
Created August 3, 2016 20:25
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 sjstebbins/72def0cdb22db9f988ec4a5f0851159b to your computer and use it in GitHub Desktop.
Save sjstebbins/72def0cdb22db9f988ec4a5f0851159b to your computer and use it in GitHub Desktop.
Globe component for shiny application
# set data to be render in arcs
flow <- reactive({
return(select(filterData(),Source.Country.Lat,Source.Country.Long,Destination.Country.Lat,Destination.Country.Long))
})
# arc thickness based on volume
volume <- reactive({
return((filterData()$volume / max(filterData()$volume, na.rm=TRUE)) * 4)
})
# set globe
output$globe <- renderGlobe(
globejs(
img=values$theme,
arcs=flow(),
arcsHeight=.9,
arcsLwd=volume(),
arcsColor=filterData()$color, #extract color column from filtered data
arcsOpacity=0.25,
pointsize=0.5,
rotationlat=values$lat,
rotationlong=values$long,
fov=50,
atmosphere=TRUE
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment