Visualizing air pollution levels in the USA

Posted on Jan 11, 2019


As a mechanical engineer, I am interested in engineering solutions that promote sustainability and a circular economy. Air pollution is a major contributor to health hazards and climate change. Therefore,as part of my first project at the NYC Data Science Academy, I have decided to create an R shiny application that models air pollution levels across various US cities. The project is based on my motivation to understand the seasonal and geographical patterns among various air pollutants.


I worked with a Dataset that provides the mean air quality index (AQI) for four pollutants of major cities in all 51 states. AQIs were calculated 4 times per day over the period of 01/01/2000 to 12/31/2010.

    • SO2: Sulfur Dioxide
    • CO: Carbon Monoxid
    • O3: Ozone
    • NO2:Nitrogen Dioxide

PM2.5 AQI Chart

Pollution Calendar 

The first component of the app consists of a pollution calendar  that allows the user to examine  daily variations in air pollution from the year 2000 to 2010. The user selects the state, city , pollutant of interest and date range, displaying a calendar in the following format: 

Screenshot 2019-01-15 21.27.51.png

The screenshot above provides a  NO2 pollution calendar for San Francisco-California over the period 2003-2008. Darker colors indicate a higher air quality index which implies more pollution. As NO2 is a pollutant that peaks during the heating season, we would expect lighter colors during the summer months (June, July, August), this is consistent with our calendar. On the other hand, Ozone air quality indices are expected to peak in the summer as demonstrated in New York city's pollution calendar (2003-2008).

Screenshot 2019-01-15 21.31.20.png

Pollution By chemical

I have proceeded with BoxPlots that compare the pollution levels of various pollutants in the same city.  median pollution levels were grouped by month.

Screenshot 2019-01-15 21.52.04.png

For example, the screenshot above shows that for Phenix-Arizona, NO2 and O3 pollution levels are more significant than CO and S2 pollution.

Pollution by city

The next step was to compare pollution levels across main US cities.

Screenshot 2019-01-15 21.53.34.png

I chose Boston,Chicago,Houston,Los Angelos, New York,Phoenix and San Francisco for comparison. The graph of box-plots above shows O3 pollution levels. the box-plots demonstrate the fact the warmer cities have higher levels of ozone pollution: Phoenix ranking first and Chicago ranking last.

Least & Most Polluted Cities

Screenshot 2019-01-11 14.44.54.png

I have explored the top 10 polluted and east polluted cities per chemical. The Box-plots above for CO pollution show that major cities such as Los Angelos and Denver consistently rank in the top 10 most polluted cities.

Evolution of pollution levels

Has pollution been increasing or decreasing over time? It is no secret that governments and municipalities has been taking measures to reduce air pollution. Can this be confirmed by modeling pollution levels from 200 to 2010? To answer this question, I have generated plots that the evolution of air quality over the years. The plots show that there is a decreasing trend for most cities in the level of all pollutants. An example would be this plot of NO2 pollution in Detroit approximated with a linear trend.

Screenshot 2019-01-11 14.56.24.png

About Author


karim El Zaatari

Data Scientist and mechanical engineering graduate with a demonstrated record of leadership & problem solving. My data science projects span over various topics including air pollution, carpooling,house pricing and machine learning in horse racing.
View all posts by karim El Zaatari >

Leave a Comment

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags