# 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)
$Status <- factor(banknote$Status) banknote
Homework 8: Graphics
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.
= r.banknote # Copy data from R banknote
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?
Use
ggplot2
orplotnine
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)Use
ggplot2
orplotnine
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.Use
ggplot2
orplotnine
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.