Skip to content

Instantly share code, notes, and snippets.

@chasemc
Last active May 1, 2019 14:08
Show Gist options
  • Save chasemc/105a74edc2dceedeaf4935673adf9842 to your computer and use it in GitHub Desktop.
Save chasemc/105a74edc2dceedeaf4935673adf9842 to your computer and use it in GitHub Desktop.
mapsNgenes
# Need some subset of these packages:
#library(readxl)
#library(sf)
#library(sp)
#library(leaflet)
#library(leaflet.extras)
#library(dplyr)
#library(shiny)
#library(ggplot2)
#library(maps)
#library(mapdata)
m <- map_data("worldHires",
xlim = c(min(a$Longitude) - 4,
max(a$Longitude) + 4) ,
ylim=c(min(a$Latitude) - 4,
max(a$Latitude) + 4))
points(a$Longitude, a$Latitude, pch=20, cex=sqrt(a$value))
p <- ggplot(a) +
geom_polygon(data = m, aes(x=long, y = lat, group = group), fill = NA, color = "black") +
coord_cartesian(xlim = c(min(a$Longitude) - 3,
max(a$Longitude) + 3),
ylim = c(min(a$Latitude) - 3,
max(a$Latitude) + 3)) +
geom_point(aes(x = Longitude, y = Latitude, size = sqrt(value)), col = "red") +
transition_states(variable, transition_length = 3, state_length = 1) +
enter_fade() +
exit_fade()
animate(p, renderer = ffmpeg_renderer(), nframes = 3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment