library(tidyverse)
<- read_csv("https://bcdanl.github.io/data/nbc_show.csv") nbc_show
Color vs. Facet
Classwork 10
NBC Show Data
The nbc_show
data is from NBC’s TV pilots:
- Gross Ratings Points (
GRP
): estimated total viewership of the show, which measures broadcast marketability.- A higher GRP suggests broader exposure and a potentially more marketable show.
- Projected Engagement (
PE
): how engaged viewers were after watching a show, a more suitable measure of audience.- After watching a show, a viewer is quizzed on order and detail.
- This measures their engagement with the show (and ads!).
- High PE values suggest strong engagement.
Q1a
- Provide
ggplot()
code to describe the relationship betweenGRP
andPE
.
Answer:
ggplot(data = nbc_show,
mapping = aes(x = GRP,
y = PE)) +
geom_point() +
geom_smooth()
ggplot(data = nbc_show,
mapping = aes(x = GRP,
y = PE)) +
geom_point() +
geom_smooth(method = "lm")
Q1b
- Provide
ggplot()
code to describe how the relationship betweenGRP
andPE
varies byGenre
.
Answer:
ggplot(data = nbc_show,
mapping = aes(x = GRP,
y = PE,
color = Genre)) +
geom_point() +
geom_smooth(method = "lm",
se = FALSE) # se = FALSE turns off the ribbon
ggplot(data = nbc_show,
mapping = aes(x = GRP,
y = PE,
color = Genre)) +
geom_point(show.legend = FALSE) +
geom_smooth(method = "lm",
show.legend = FALSE,
se = FALSE) + # se = FALSE turns off the ribbon
facet_wrap(~Genre)
Q1c
- What are the advantages to using faceting instead of the
color
aesthetic? What are the disadvantages? How might the balance change if you had a larger dataset?
Answer:
- Advantages of Faceting
- Clarity for Multiple Categories: Faceting avoids the visual clutter of overlapping points and lines, especially when the number of categories (e.g.,
Genre
) is large. - Highlights Individual Patterns: By splitting the data into separate plots, it’s easier to observe specific trends or outliers within each genre.
- Improved Readability: Each genre gets its own visual space, avoiding the need to distinguish between multiple colors.
- Clarity for Multiple Categories: Faceting avoids the visual clutter of overlapping points and lines, especially when the number of categories (e.g.,
- Disadvantages of Faceting
- Difficult Cross-Category Comparison: Observations in separate facets cannot be directly compared. Audiences need to read through all facets.
- Impact with Larger Dataset
- More Data Points: Overlapping increases, making faceting a more practical option to reduce clutter. Color aesthetics may struggle to show patterns with dense data points.
- More Categories: Differentiating between colors becomes harder as the number of categories increases. In such cases, faceting is clearer.
- Transparency Issues: Using transparency (
alpha
) with many overlapping points and colors can result in a loss of clear category identification.