Assignment6 1
Assignment6 1
Learning Objectives
The goal of this assignment is to become familiar with interactive visualizations and ipywidgets.
Data
Instructions
Using the provided data sets, create a Jupyter notebook to answer the following questions.
You may only import the pandas, Matplotlib, Seaborn, ipywidgets, and math or NumPy packages.
The following heatmap shows the average carat weight of diamonds relative to their clarity and
colour. An interactive dropdown menu allows for the data to be filtered around the origin of the
diamonds. The “Natural” option filters to only naturally occurring diamonds, “Lab” filters to
manufactured diamonds, and “All’ applies no filtering. In the example below, we can see that the
heaviest diamonds are those with the poorest quality.
Re-create the above heatmap and interactive control. The heatmap should update based upon the
item selected in the dropdown menu.
The colour map is “mako”. The ordering of the colour and clarity should be in ascending order,
such that colourless, internally flawless diamonds are in the top right.
The interactive visualization below shows the height and weight distributions for gold-medal
winning athletes in the 2000 to 2016 Olympics (inclusive). The default view is a heat map where
the data has been binned in value increments of 5, that is, 20 to 25, 25 to 30, 30 to 35, etc. (Hint:
Seaborn’s heatmap is the hard way to do this. What else can bin data?)
The dropdown menu filters the athletes to a specific sport category. The options are Swimming,
Wrestling, Fencing, Athletics, Shooting, Cycling, Rowing, and Gymnastics, plus a “Combined”
option that is the combination of athletes from all of those sports.
The “kde” checkbox will change the visualization to a contour plot of the distribution estimated
using kernel density estimation, as shown below.
The image below shows an interactive visualization of used car sales data from the used_cars.csv
data set. The price of the car is along the x-axis and the mileage of the car along the y-axis.
There are three interactive controls. The first is a dropdown menu in which the user can select one
of the available years in the data set. The second is a dropdown menu from which the user can
select a car brand based on the brands that were sold in the selected year. The third is a multi-select
box that allows the user to select multiple models of cars that were sold for the selected year and
car brand.
Attribution
Submissions should include an attribution section indicating any sources of material, ideas or
contribution of others to the submission.
Submissions must represent your independent work.
You are encouraged to use any resources to help with your solution, but your solution must represent
independent work. If your submitted work includes unacknowledged collaboration, code materials,
ideas or other elements that are not your original work, it may be considered plagiarism or some
other form of cheating under MUN general regulations 6.12.4.2 (4.12.4.2 for graduate students)
and academic penalties will be applied accordingly.
Avoid academic penalties by properly attributing any contribution to your submission by others,
including internet sources and classmates. This will also help distinguish what elements of the
submission are original. You may not receive full credit if your original elements are insufficient,
but you can avoid penalties for plagiarism or copying if you acknowledge your sources.
Github
I encourage you to store and version your work on GitHub. It is good practice to do so as everyone
uses git in the real world.
However, it is a requirement that git repositories containing assignment material be private.
University regulations (undergraduate 6.12.4.2 and graduate 4.12.4.2) consider it cheating if you
allow your work to be copied. There will be zero tolerance for this.