Visualisation project

Project set

Roland Krause

MADS6

Tuesday, 12 November 2024

Today

Final ideas

Data visualisation

Objectives today

Ensuring that everybody has

  • knows how far you are in your project
  • created and shared(!) github repo
    • with data installation/include
    • shared with instructors

Aims

Making sure that your projects can be completed with reasonable amout of effort.

15min Presentations

For those that have not previously presented with code.

  • Groups for final presentation
  • Time line

What is a plot effort?

Is this an effort?

  • Only two dimensions, default settings, no story!

Or this?

Code
ggplot(swiss |> as_tibble(rownames = "Province")) +
  aes(x = Education, y = Agriculture) +
  geom_point() +
  geom_smooth(method = "lm") +
  labs(subtitle = "Negative relation of agriculture with school education levels in Switzerland ",
       title = "Cities provide better education") 

Includes story but missing another dimension

Topics

  • Choosing the right visualistion

Principles

  • Pie charts are for pies
  • Show the data
  • Overplotting
  • Data to ink (table vs bar plot)
  • Normalize map plots by area or population
  • Tell a story

Overplotting

Code
peng <- ggplot(penguins) +
  aes(x = bill_length_mm, y = bill_depth_mm) +
  xlim(20, 80) +
  ylim(10, 25) +
  labs(x = "Length (mm)", y = "Depth (mm)", 
       title = "Dimensions of penguin bills") +
  theme_minimal()
peng +
  geom_point(alpha = 0.3)

Avoiding overplotting with densities

2D density plot

Code
peng +  
  geom_point(size = 0.3, color = "white") +
  geom_density_2d_filled()

Why are the points not visible?

Plotting order matters

Code
peng +
  geom_density_2d_filled() +
  geom_point(size = 0.3,
             color = "white")

::::

Hexbin

Alternative hex

Code
ggplot(diamonds) +  
  aes(carat, price) +
  geom_hex()

Real efforts

This is an effort

Cedric Scherer

Demonstration in class

Feedback

Next routes for data visualisation

Your presentations