Last active
May 11, 2018 20:05
-
-
Save fawda123/1870bb6f093b86139addcc515503a39e to your computer and use it in GitHub Desktop.
plotlymapviewex
This file contains hidden or 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
# load packages | |
library(sf) | |
library(plotly) | |
library(mapview) | |
# download data and save in memory | |
wsa <- read.csv("https://www.epa.gov/sites/production/files/2014-10/wsa_siteinfo_ts_final.csv") | |
# make an sf object | |
wsa <- st_as_sf(wsa, coords = c("LON_DD", "LAT_DD"), crs = 4269,agr = "constant") | |
# plotly scatterplot | |
plot_ly(wsa, x = ~XELEV, y = ~WSAREA) %>% | |
add_markers() | |
# plotly using ggplotly | |
p <- ggplot(wsa, aes(x = XELEV, y = WSAREA)) + | |
geom_point() | |
ggplotly(p) | |
# use mapview | |
mapview(wsa, zcol = 'XELEV') | |
mapview(wsa, zcol = 'WSAREA') | |
mapview(wsa, zcol = 'ECOWSA9') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment