Created
August 3, 2016 20:25
-
-
Save sjstebbins/72def0cdb22db9f988ec4a5f0851159b to your computer and use it in GitHub Desktop.
Globe component for shiny application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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