#| label: load-libraries-data#| warning: false#| message: false#| warning: truelibrary(tidyverse) # For ggplot, dplyr, and friends
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.2 ✔ tibble 3.3.0
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.0.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library (ggridges) # For the ridgeline plotlibrary (ggrepel) # For clean annotationslibrary(plotly)
Warning: package 'plotly' was built under R version 4.5.1
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(tinytex)
Warning: package 'tinytex' was built under R version 4.5.1
Rows: 381 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): Agency, Station Name, Line, Artist, Art Title, Art Material, Art De...
dbl (1): Art Date
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Plotting a bar chart to visualize the number of artwork by year over a 10-year period
Art_display <-ggplot(MTAart_filtered, aes(x =`Art Date`, fill = Agency)) +geom_bar(position ="dodge") +labs(title ="Artwork display per year by agency (2013-2023)",x ="Year",y ="Count", caption="Source: MTA Permanent Art Catalog (Beginning 1980) — https://www.mta.info/open-data.\n\nAfter 2020, there’s a noticeable decline across agencies, possibly reflecting disruptions due to the COVID-19 pandemic.") +theme_minimal()+theme(panel.border =element_blank(),plot.background =element_blank(),panel.grid.major =element_line(linetype ="blank"),panel.grid.minor =element_line(linetype ="blank"),axis.line =element_line(color ="black"))Art_display
Public_art <-ggplot(MTAart_filtered, aes(x=`Art Date`, y= Agency, fill =Agency))+geom_density_ridges(alpha =0.7, scale =2, rel_min_height =0.01) +labs(title ="MTA Public Art Displays by Agency (2013–2023)",x ="Year",y ="MTA Agency", caption="Source: MTA Permanent Art Catalog (Beginning 1980) — https://www.mta.info/open-data.\n\nThis plot illustrates the distribution of public art displays across MTA agencies from 2013 to 2023.\nPeaks in 2017–2019 reflect high activity; the decline after 2020 likely reflects pandemic disruptions.") +theme_minimal()+theme(panel.grid.major =element_blank(),panel.grid.minor =element_blank(),plot.title =element_text(face ="bold"),plot.subtitle =element_text(hjust =0),legend.position ="none" )ggsave("Public_art.png", plot = Public_art, width =10, height =6, units ="in", dpi =300)