moma-collection

The Museum of Modern Art (MoMA) collection data.
git clone https://git.eamoncaddigan.net/moma-collection.git
Log | Files | Refs | README | LICENSE

commit d914e1dbd21a0374e8ab29be2edd8b7b2d7a6554
parent 11fbfc68ee62d6d940b2fade45062416199bf509
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Tue, 28 Jul 2015 22:34:07 -0400

Still buggy.

Diffstat:
MacquisitionsByDepartment.R | 29+++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/acquisitionsByDepartment.R b/acquisitionsByDepartment.R @@ -9,17 +9,19 @@ require(ggplot2) rm(list=ls()) artworks <- read.csv("Artworks.csv", stringsAsFactors = FALSE) +departments <- c("Painting & Sculpture", + "Drawings", + "Architecture & Design", + "Photography", + "Prints & Illustrated Books") + # Just pull out the year, since dates aren't always formatted correctly, and # make Department a factor. artworks <- artworks %>% filter(grepl("[0-9]{4}", DateAcquired)) %>% mutate(year_acquired = as.numeric(sub(".*([0-9]{4}).*", "\\1", DateAcquired)), - Department = factor(Department, c("Painting & Sculpture", - "Drawings", - "Architecture & Design", - "Photography", - "Prints & Illustrated Books"))) %>% - filter(!is.na(Department)) + Department = ifelse(Department %in% departments, Department, "Other"), + Department = factor(Department, c("Other", departments))) # Find the cummulative number of works from each department artworks.tally <- artworks %>% @@ -28,10 +30,17 @@ artworks.tally <- artworks %>% group_by(Department) %>% mutate(total_works=cumsum(n)) -# This is buggy here. Gonna try to run it somewhere else. :/ -p1 <- ggplot(artworks.tally, aes(x=year_acquired, y=total_works, fill=Department)) + +# XXX - This is buggy here, the notches seem to be a ggplot2 error. :( +p1 <- artworks.tally %>% + ggplot(aes(x=year_acquired, y=total_works, fill=Department)) + geom_area(position="stack") + theme_minimal() + - scale_fill_brewer(type="qual", palette = "Dark2") + scale_fill_brewer(type="qual", palette = "Dark2") + + scale_x_continuous(breaks=round(seq(min(artworks$year_acquired), + max(artworks$year_acquired), + length.out = 5))) + + labs(title = "MoMA's cummulative works by time", + y = "Total works", + x = "Year acquired") print(p1) -#ggsave("age_at_acquisition.png") +ggsave("cummulative_works.png")