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

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp