Sergiy Kramarev
November 13, 2018
Data for this demo application comes from state.x77 table that comes with R. Data have 50 rows and 8 columns which represent different statistical data about US in 1970-th. Main function of the application in to present data that stored in this table in an interactive way on a plotly map.
## Population Income Illiteracy Life Exp Murder HS Grad
## Alabama 3615 3624 2.1 69.05 15.1 41.3
## Alaska 365 6315 1.5 69.31 11.3 66.7
## Arizona 2212 4530 1.8 70.55 7.8 58.1
## Arkansas 2110 3378 1.9 70.66 10.1 39.9
## California 21198 5114 1.1 71.71 10.3 62.6
## Colorado 2541 4884 0.7 72.06 6.8 63.9
library(plotly)
states <- as.data.frame(state.x77)
states$Abb <- state.abb
g <- list(
scope = "usa",
projection = list(type = "albers usa"),
showlakes = TRUE,
lakecolor = toRGB("white"))
states$popup <- with(states, paste("Income", ": ", states[,2], sep = "" ))
plot_geo(states, locationmode = "USA-states", text = ~popup) %>%
add_trace(z = states[, 1], color = states[,1], colors = "Greens", locations = ~Abb) %>%
layout(geo = g, title = "US statistical data")