-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only france-reg, france-reg-2016, france-dep, usa-states are available? #2
Comments
Yes more regions can be included ! Which one do you want ? |
Thank you. |
I've integrated the first level of administrative divisions for Sweden, you can test with : devtools::install_github("pvictor/topogRam")
library(topogRam)
# Population data
sweden_data <- data.frame(
id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21"),
name = c("Östergötland", "Blekinge", "Dalarna", "Gävleborg", "Gotland", "Halland", "Jämtland", "Jönköping", "Kalmar",
"Kronoberg", "Norrbotten", "Orebro", "Södermanland", "Skåne", "Stockholm", "Uppsala", "Värmland", "Västerbotten", "Västernorrland",
"Västmanland", "Västra Götaland"),
population = c(452105, 158453, 284531, 284586, 284586, 320333, 128673, 352735, 242301, 194628, 250570, 294941, 288097, 1324565, 2269060,
361373, 279334, 265881, 245572, 267629, 1671783),
stringsAsFactors = FALSE
)
# Make a topogRam
topogRam(
data = sweden_data,
shape = "sweden-1",
key_var = "population",
geo_lab = "name",
colors = brewer.pal("Reds", n = 3),
origin = c(22, 60), scale = 2500
)
# Create a random variable
sweden_data$random <- sample(sweden_data$population)
# Test with two variables
topogRam(
data = sweden_data,
shape = "sweden-1",
key_var = c("population", "random"),
geo_lab = "name",
colors = brewer.pal("Reds", n = 3),
origin = c(22, 60), scale = 2500
) |
Thank you so much. It works smoothly. |
You're welcome! You're right the core part is the shape file, it's in fact a topojson; The step to create it are a little manual for the moment, i'll look to automatize and describe the process. |
Would be great if in the future we can just point to some Spatial Data Frame/shapefile and have toporgRam do the rest! |
Yes it would be top, what's complicated is that topogram.js needs topojson to work, I'll try to find some time to see if a standalone R solution exists. And I'll migrate to D3v4 too. |
Any chance more regions will be included?
Thank you.
The text was updated successfully, but these errors were encountered: