Created
November 6, 2019 16:40
-
-
Save ryanbateman/b0abe023996cb15119c9c909f5615be6 to your computer and use it in GitHub Desktop.
NYC Tree Census 2015
This file contains 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
require("ggplot2") | |
require("viridis") | |
require("colorBrewer") | |
require("randomcoloR") | |
trees <- read.csv("trees.csv") | |
trees$health <- factor(trees$health) | |
trees$spc_common <- factor(trees$spc_common) | |
colours <- sample(grDevices::colors()[grep('gr(a|e)y', grDevices::colors(), invert = T)], length(trees$spc_common)) | |
ggplot(data = trees, | |
aes(x = Latitude, y = longitude)) + | |
geom_point(size = 0.5, alpha = 0.4, aes(color = spc_common)) + | |
scale_color_manual(values = colours) + | |
theme(axis.line = element_blank(), | |
panel.grid.major = element_blank(), | |
panel.grid.minor = element_blank(), | |
panel.border = element_blank(), | |
panel.background = element_blank()) + | |
ggtitle("2015 Tree Census of New York") + | |
xlab("Latitude") + ylab("Longitude") + | |
ggsave("tree_census_2015_legend.png", | |
width = 100, | |
heigh = 100, | |
units = "cm", | |
dpi = "retina") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment