Created
December 7, 2017 08:56
-
-
Save yaojenkuo/b5a9e73593b52babe047668e3061bb23 to your computer and use it in GitHub Desktop.
gapminder_replica/server.R
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
# Define server logic required to draw a Gapminder visualization | |
shinyServer(function(input, output) { | |
tidy_data <- reactive( | |
tidy_df %>% | |
filter(Region %in% input$regions) | |
) | |
output$bubble <- renderPlotly({ | |
# draw the bubble chart with the specified continents or year | |
tidy_data() %>% | |
plot_ly(x = ~gdpPercap, y = ~lifeExp, size = ~pop, type = "scatter", mode = "markers", frame = ~year, color = ~Region, text = ~Country.Name, hoverinfo = "text", sizes = c(min(bubble_radius, na.rm = TRUE), max(bubble_radius, na.rm = TRUE))) %>% | |
layout(xaxis = list(title = "GDP Per Capita", | |
type = "log"), | |
yaxis = list(title = "Life Expectancy")) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment