STAT 1080 - Fall 2026
  • Course Info
    • Overview
    • Syllabus
    • Support
    • Schedule
    • Useful links
  • Weekly Materials
    • W1. Introduction
    • W2. RStudio
    • W3. Correlation
    • W4. Programming
    • W5. Tidyverse
    • W6. Dates/Times and Distributions
    • W7. Data Visualization
    • W8. Statistics & Probability
    • W9. Data & Probability
    • W10. Random Variables
    • W11. Parameters & Estimates
    • W12. Statistical Inference
    • W13. Regression
    • W14. Regression
    • W15. Project Meetings

On this page

  • Swiss Banknotes
    • Understanding The Data
    • Examining Status
    • Detecting Counterfeits
    • Detecting Counterfeits, Part II
  • Take everything you know, and use it for evil
  • Useful References
  • Report an issue

Stat 1080 Lab: Data Visualization

Author

Your Name Here

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.

The following code will check to see if mclust is installed, and if it is not, it will install the package before loading the banknote data.

Understanding The Data

The following chunks use object-inspection functions to get a sense of the data. Answer the questions below.

'data.frame':   200 obs. of  7 variables:
 $ Status  : Factor w/ 2 levels "counterfeit",..: 2 2 2 2 2 2 2 2 2 2 ...
 $ Length  : num  215 215 215 215 215 ...
 $ Left    : num  131 130 130 130 130 ...
 $ Right   : num  131 130 130 130 130 ...
 $ Bottom  : num  9 8.1 8.7 7.5 10.4 9 7.9 7.2 8.2 9.2 ...
 $ Top     : num  9.7 9.5 9.6 10.4 7.7 10.1 9.6 10.7 11 10 ...
 $ Diagonal: num  141 142 142 142 142 ...
         Status        Length         Left         Right         Bottom     
 counterfeit:100   Min.   :214   Min.   :129   Min.   :129   Min.   : 7.20  
 genuine    :100   1st Qu.:215   1st Qu.:130   1st Qu.:130   1st Qu.: 8.20  
                   Median :215   Median :130   Median :130   Median : 9.10  
                   Mean   :215   Mean   :130   Mean   :130   Mean   : 9.42  
                   3rd Qu.:215   3rd Qu.:130   3rd Qu.:130   3rd Qu.:10.60  
                   Max.   :216   Max.   :131   Max.   :131   Max.   :12.70  
      Top          Diagonal  
 Min.   : 7.7   Min.   :138  
 1st Qu.:10.1   1st Qu.:140  
 Median :10.6   Median :140  
 Mean   :10.7   Mean   :140  
 3rd Qu.:11.2   3rd Qu.:142  
 Max.   :12.3   Max.   :142  

Hint: You can read the documentation about the dataset by typing ?banknote in the console. This will provide additional context in the Help window.

How many observations are there which are counterfeit? How many are genuine?

Replace this with your answer

What units are the measurements in?

Replace this with your answer

Which measurements have the most variability, measured by the range of observations?

Replace this with your answer

Examining Status

Draw a barchart of Status. In addition to showing status on the x or y axis (your choice), map status to the fill color of the bars. (Yes, this plot is a bit simplistic, but what does it show? Does it confirm your answer in the previous question?) In the chunk below, edit the fig-cap chunk option (replacing “Your description goes here” with your answer) to provide a meaningful 3-sentence caption that addresses the following:

  1. What type of plot is this?
  2. Which variables are mapped to x, y, and fill?
  3. What is the main finding from the plot?

Detecting Counterfeits

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. Choose the binwidth such that there are no gaps in the middle range of the histogram. In the chunk below, edit the fig-cap chunk option (replacing “Your description goes here” with your answer) to provide a meaningful 3-sentence caption that addresses the following:

  1. What type of plot is this?
  2. Which variables are mapped to x, y, and fill?
  3. What is the main finding from the plot?

Detecting Counterfeits, Part II

The code below draws a scatterplot of two (continuous) measurements. Modify the code to color points by whether the banknote is genuine or fake. What can you conclude from the plot about how these two measurements can be used to detect counterfeit bills?

In the chunk below, edit the fig-cap chunk option (replacing “Your description goes here” with your answer) to provide a meaningful 3-sentence caption that addresses the following:

  1. What type of plot is this?
  2. Which variables are mapped to x, y, and fill?
  3. What is the main finding from the plot?

Take everything you know, and use it for evil

We spent some time discussing principles of good graphics in class, but we spent less time showing you all of the different ways you could customize graphics in ggplot2. Here, I want you to create the ugliest graphs (e.g. least useful, violating the most principles of good graphics) you can, and then explain why, exactly, the graphs are ugly, and which principles of good graphics you’ve intentionally violated. Note that it is not enough for your chart to be aesthetically displeasing - you should strive to make the chart functionally ineffective by violating principles of good graphics.

Of course, ugliness is subjective. One goal of this assignment is for you to explore the different ways you can customize the finer details of a plot: color schemes, theme elements, shape mappings, and so on.

Requirements: - Your finished masterpiece must have appropriate axis labels and a title (after all, even ugly plots need to be correctly labeled!). - Your ugliness should not depend solely on color choices - there are many other ways to make things ugly!

You are free to add additional variables and layers, modify the aesthetics used, and leverage other packages. If you use packages I haven’t used in the book, please provide (commented out) installation code in your code chunks, modeled on the code which installs mclust at the start of this assignment.

If you need inspiration, look here.

Use the penguins data, which is loaded in the chunk below.

  species    island bill_len bill_dep flipper_len body_mass    sex year
1  Adelie Torgersen     39.1     18.7         181      3750   male 2007
2  Adelie Torgersen     39.5     17.4         186      3800 female 2007
3  Adelie Torgersen     40.3     18.0         195      3250 female 2007
4  Adelie Torgersen       NA       NA          NA        NA   <NA> 2007
5  Adelie Torgersen     36.7     19.3         193      3450 female 2007
6  Adelie Torgersen     39.3     20.6         190      3650   male 2007

Create the ugliest graph you can manage. You can pick which variables to plot, what type of chart to make, and what aesthetic mappings to use.

When you are finished, edit the fig-cap chunk option (replacing “Your description goes here” with your answer) to provide a meaningful 3-sentence caption that addresses the following:

  1. What type of plot is this?
  2. Which variables are mapped to which aesthetics?
  3. What is the main finding from the plot?

Delete this line and explain why your graph is ugly - what principles of good graphics have you violated?

Useful References

  • Customizing ggplot2 graphics

  • A group-created slideshow of awful graphics

© Copyright 2026, Susan Vanderplas

 
  • Report an issue