Data Visualization on Air Quality

Posted on Feb 16, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
Contributed by Bin Lin. Bin is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between January 11th to April 1st, 2016. This post is based on his first class project - R Visiualization (due on the 6th week of the program).


Data shows air pollution is a leading cause of death across the globe, and contributes to stroke, heart disease, lung cancer, and other respiratory illness. The goal of this project is to explore the air quality of the New York tri-state area.


The datasets used in this project cover the daily data between year 1980 – 2015 for New York tri-state area. Air quality data are  collected at outdoor monitors across the United States and can be download from EPA (Environment Protection Agency) web site

The AQI is an index for reporting daily air quality. It tells you how clean or polluted your air is, and what associated health effects might be a concern for you. The higher the AQI value, the greater the level of air pollution and the greater the health concern. Smaller AQI means better air quality.

EPA calculates the AQI for five major air pollutants regulated by the Clean Air Act:

  • Ozone
  • PM (Particle pollution or particulate matter)
  • CO (carbon monoxide)
  • SO2 (sulfur dioxide)
  • NO2 (nitrogen dioxide)

Therefore, in our data and visualiztion analysis, we will only be seeing the AQI of these pollutants. See Figure 1 for example of the data. And the Overall AQI is the maximum AQI among these pollutants (Overall AQI = max(Ozone, PM10, PM25, CO, SO2, NO2) ). Note that PM2.5 are not being monitored until late 1990's. Therefore there will be some missingness for PM25 variable.

Figure 1: Example of data


EPA has divided AQI into six categories, which represent the level of air quality conditions. See Figure 2 below for the AQI ranges and corresponding air quality conditions.


Data Visualization Analysis:

At First Glance:

First question, from 1980 to now, is air quality in New York tri-state area getting better  or worse? Let's take a quick visual overview at the air quality over time. See below Figure 3

  • Figure 3 is the scatterplot of AQI on dates. There is also a blue line indicating the mean of the over all AQI.
  • AQI has been decreasing which means  air quality is getting better
  • Before 1990's, averaged AQI had been decreasing, however air quality still frequently fell into the "Unhealthy for Sensitive Groups" condition, and sometimes even the "Unhealthy" or "Very Unhealthy" condition.
  • Since 1990's, AQI has been continuously decreasing,  air quality mostly has been mostly "Moderate" or "Good" condition.
  • Thanks for the Clean Air Act (1963), which helps reduce the air pollution.

Figure 3: AQI on Date in New York Tri-state Area


Main Pollutants:

Now, let's look at what are pollutants as the main pollutants over time. Recall that the pollutant with highest API will be selected as  main pollutant and its API will be used as the over all AQI.

  • Figure 4 is a stack bar plot that shows the yearly summary of main pollutants.
  • Figure 5 is a sactterpot that shows the main pollutant on each date.
  • Both convey tat CO and SO2 had showed up quite frequently but the frequency as main pollutant has been decreasing. Ozone and PM2.5 with high AQI show up quite frequently in the recent years.
  • Ground-level ozone and airborne particles are the two pollutants that pose the greatest threat to human health in the United States.

Figure 4: Percentage of Each Pollutant as Main Pollutant on Each Year


Figure 5: Percentage of Each Pollutant as Main Pollutant on Date


AQI of Each Pollutant:

If by look at just the over all AQI and the corresponding main pollutant, it can not be told what the  AQI of other pollutants are and how they impact our health.

  • Figure 6 is a smooth line graph that plots the mean AQI of each pollutant over time.
  • Figure 7 is a connected line graph that plots AQI of each pollutant on each date.
  • Both convey that while AQIs of CO, SO2, and PM10 have been continuously dropping to low level, Ozone, NO2, and PM2.5 haven't dropped that much. Especially from Figure 7, these stubborn bad ones reach to high AQI that is over 100 or even 200 (meaning unhealthy air quality condition).
  • Main reason of the high AQI of Ozone, NO2, and PM2.5 are related to high number of factories, high number of vehicles, and other source of pollution that are still not under well controlled.

Figure 6: Mean AQI of each pollutant over time


Figure 7: AQI of each pollutant on each date


Source 8: Sources of Pollution


 Monthly View of Air Quality:

Here is another question? In which months the air quality conditions are good (or bad) in New York tri-state area? Figure 9 tells us that in general, air quality conditions are bad during the summers. Especially from June to August, the averaged air quality is in the "Unhealthy for Sensitive Groups" level. This probably is because more people are driving during summer and more Air Conditioner are turned on. So, go to a trip away from home during summer to enjoy better air somewhere else!

Figure 9: Mean Over All AQI Group by Month


Air Quality of Manhattan after September 11 2001:

As I have been wondering the air quality of Manhattan on and after September 11, 2001, I have download the AQI data for Manhattan during that time of period to explore.

  • Figure 10 is the scatter point and line graph that plots the daily AQI from September to November 2001.
  • Figure 10 shows that over all AQI was under 50 or 100 most of the time, which indicates that air quality was still  "Moderate" or "Good" level. There was NO drastic change based on the AQI.
  • As AQI tells you the air quality based on the monitored pollutants only, it doesn't tell you when the air contains other bad matters. On and after September 11 2001, there were high toxicity of the air, and Word Trade Center dust included asbestos and disturbingly high PH levels. Many people have suffered health effects because of that.

Figure 10: AQI of Manhattan around September 11 2001



As air quality has been improved and there are still pollutants (Ozone, NO2, and PM2.5) retain at high AQI. Effort should continuously be made to reduce them. How can we make a difference? Drive less, use less electricity, don't burn wood or trash, support measures in your community that can cut air pollution, etc.

Also air quality continues to worsen in cities across the world, especially in low-income countries and developing countries.  Cooperation should be setup among countries in combating air pollution.

About Author

Bin Lin

Bin is a former professional in software development with now positioned for Data Scientist role. With both strong programming skill and newly acquired machine learning skills, Bin is able to apply scientific thinking to predict or uncover insights...
View all posts by Bin Lin >

Related Articles

Leave a Comment

Google August 28, 2021
Google Every once inside a even though we select blogs that we read. Listed below are the newest web sites that we pick.
Google January 2, 2021
Google Every once inside a although we pick out blogs that we study. Listed below are the newest web pages that we pick out.
Google December 25, 2020
Google Here are some links to sites that we link to because we assume they are really worth visiting.
CBD Oil For Dogs December 15, 2020
CBD Oil For Dogs [...]the time to study or go to the content or web sites we've linked to beneath the[...] November 14, 2020 [...]below you’ll uncover the link to some web-sites that we think you ought to visit[...]
Google September 4, 2020
Google That may be the finish of this article. Right here you will come across some websites that we consider you’ll enjoy, just click the hyperlinks.
Google September 3, 2020
Google Wonderful story, reckoned we could combine several unrelated data, nevertheless definitely really worth taking a appear, whoa did one find out about Mid East has got much more problerms too.
Windows August 28, 2020
Windows [...]Here is a good Blog You might Uncover Intriguing that we Encourage You[...]
OnHax Me August 19, 2020
OnHax Me [...]here are some links to internet sites that we link to mainly because we consider they are really worth visiting[...] August 5, 2020 [...]we prefer to honor quite a few other world-wide-web web pages around the web, even when they aren’t linked to us, by linking to them. Beneath are some webpages worth checking out[...] July 30, 2020 [...]please pay a visit to the internet sites we comply with, including this one, as it represents our picks from the web[...]
cbd for cats July 9, 2020
cbd for cats [...]Here are several of the web pages we advocate for our visitors[...]

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans 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 boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis 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 seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI