Data Visualization of Gun Violence in the United States

Posted on Apr 27, 2019
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.


Gun control and possession rights is one of the most controversial topics in the United States, mostly because of the associated violences and crimes that come with having guns as a weapon. It is difficult to find data statistics on gun violence and crime without the bias of third party organizations.

The goal of this app is to help the user visualize trends in gun violence incidents though various observations without bias. With a more broad understanding of the trends of gun violence, we can see where to actively target certain areas to help decrease the amount of gun violence in the future.Β 



This dataset is sourced from Kaggle. The dataset is derived from web scrapping techniques on another third party site,Β gunviolencearchive.orgΒ . I, and NYC Data Science Academy, do not own this dataset or was involved with web scrapping it. For more information, please visit the provided links.

To aid in the analysis of this dataset, I used theΒ Annual Estimates of the Resident Population for the United States, Regions, States, and Puerto Rico: April 1, 2010 to July 1, 2018Β table. This gave the population size for each state, including the District of Columbia, to help accurately compare crime rates.


The dataset is 230,000+ gun related incidents that have been recorded on all states since March 2013, up to March 2018. This dataset was joined with population data in R Studio. The joined table was further cleaned with added columns for analysis.Β 


We first start with a couple of overview plots to get a general idea of the dispersion of gun related crime incidents.Β 

We have a map of the continental US with markers for the locations of incidents based on the number of effected people. Affected people represent the number of people that were killed or injured during the event. The user is to select the number of affected persons per a given incident from the dropdown menu. We see in the image below the places with incidents with 3 affected persons.

Data Visualization of Gun Violence in the United States

TheΒ US Chart tab contains a chart of the number of incidents per every 100,000 people in each state. This chart takes into account population sizes in each state so that the number of incidents can be compared on an equal basis. We see below that the place with the most number of incidents is the District of Columbia, with 147.68 incidents per every 100,000 people.Β 

Data Visualization of Gun Violence in the United States

While this is a shockingly high number, DC is known for having incredibly high crime rates, mostly due to various drug wars and the striking wealth gap.Β Β 

Data on Different States:

The user is allowed to pick a state and look into the distribution of incidents for that state. Among the options include looking at the number of incidents from the years 2014 to 2017, as well as looking at the number of incidents by city or county. Only the top 20 cities/counties with the highest number of gun violence incidents are shown.

Note: District of Columbia does not have counties and cities. Although these numbers are not normalized by population in each city/county, cities with the highest number of people were NOT the places with the most number of incidents. Below, we see that in California, the city with the highest number of gun related incidents is Oakland, easily outdoing higher population areas like Los Angeles and San Francisco.Β 

Furthermore, users can investigate the number of incidents and the number of homicides due to gun violence by month to examine the change in seasons. In the graph below, we can see a peak in the summer months for the number of gun related incidents in Connecticut in 2016.

Data Visualization of Gun Violence in the United States


In conclusion, this gun violence dataset gives us a broad overview of what gun related incidents look like around the United States. We are able to see some interesting results that may contradict some previous assumptions. Ultimately, I believe this dataset will be useful for people to get some solid insight on gun violence.Β 

About Author

Leave a Comment

No comments found.

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