Developing Data Products Assignment 02

M.A.A.U
8/14/2020

Gapminder Data Analysis

  • code
library(plotly)
library(gapminder)
set.seed(100)
d <- gapminder[sample(nrow(gapminder), 1000), ]
fig <- plot_ly(d,
                x = ~gdpPercap, 
                y = ~lifeExp, 
                size = ~pop, 
                color = ~continent, 
                frame = ~year, 
                #text = ~country, 
                text = ~paste("country: ", country),
                hoverinfo = "text",
                type = 'scatter',
                mode = 'markers'
            )

Figure

fig <- fig %>% layout(xaxis = list(type = "log"))
htmlwidgets::saveWidget(as.widget(fig), file = "demo.html")