Homework 8: Graphics

HW
Week10
Author

Your Name

Published

April 5, 2024

Note: This assignment must be submitted in github classroom.

Swiss Banknotes

The R package mclust contains a data set called banknote, consisting of (physical) measurements on 200 Swiss bank notes, 100 of which are genuine, while the other half is counterfeit. Load this data set (you might have to install the package) using the code below.

# install.packages("mclust")
library(mclust) # if this throws an error of the form 'there is no package called mclust', uncomment the line above, run it once, then comment the line out again and run the code chunk again.
## Package 'mclust' version 6.1
## Type 'citation("mclust")' for citing this R package in publications.
data(banknote)
banknote$Status <- factor(banknote$Status)
banknote = r.banknote # Copy data from R

For each of the three figures you create below, write a summary paragraph describing the structure of the plot:

  • What type of plot is it?
  • Which variables are mapped to x, to y, and to the (fill) color?
  • What is the main message of the plot: what is your main finding, i.e. what do you want viewers to learn from the plot?
  • Are there any anomalies or outliers?
  1. Use ggplot2 or plotnine to draw a barchart of Status. Map Status to the fill color of the barchart. This will be a relatively boring chart (but that is ok)

  2. Use ggplot2 or plotnine to draw a histogram of one of the variables in the dataset that shows a distinction between genuine and counterfeit banknotes. Use fill color to show this difference.

  3. Use ggplot2 or plotnine to draw a scatterplot of two (continuous) measurements, color by Status. Try to find a pair of measurements that allow you to separate perfectly between genuine and counterfeit banknotes.