Skip to content

Instantly share code, notes, and snippets.

@ryanbateman
Created November 6, 2019 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbateman/b0abe023996cb15119c9c909f5615be6 to your computer and use it in GitHub Desktop.
Save ryanbateman/b0abe023996cb15119c9c909f5615be6 to your computer and use it in GitHub Desktop.
NYC Tree Census 2015
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