Monash University · FACULTY OF COMPUTER SCIENCE

ETF5922 Chap.4 Grammar of Graphics and Basic Plots

- one subject, every graph, every model, every mark
8 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 4 of 11 · ETF5922

Grammar of Graphics and Basic Plots

Mappings create the visual sentence

The grammar of graphics separates data, aesthetic mappings and geometric layers. Putting colour inside aes maps a variable, while setting colour in a geom gives every mark the same appearance.

Tuning changes visible structure

Histogram bin width and density bandwidth change how local structure appears.

Rugs preserve observation locations and boxplots compress centre, spread and potential outliers.

Cross-check a distribution

Bin width changes which observations are pooled into histogram bars, while bandwidth changes the smoothing of a density estimate.

Both can reveal or conceal structure, so conclusions should survive several defensible settings.

Cross-check a distribution in context

Basic plots are alternative measurement instruments rather than interchangeable decorations.

A bar chart supports category magnitude, a histogram pools a continuous variable into intervals, a density estimate smooths observations, a rug preserves individual locations and a boxplot compresses distributional landmarks. The grammar of graphics exposes the decisions connecting data, mappings, marks, transformations and scales. Changing bin width or bandwidth performs a sensitivity analysis on visible structure.

A careful reader distinguishes features stable in the raw observations from peaks or gaps created by tuning, then selects a display combination matched to the substantive comparison.

In this chapter

What this chapter covers

  • 01

    The grammar of graphics separates data, aesthetic mappings and geometric layers.

  • 02

    Putting colour inside aes maps a variable, while setting colour in a geom gives every mark the same appearance.

  • 03

    Histogram bin width and density bandwidth change how local structure appears.

  • 04

    Rugs preserve observation locations and boxplots compress centre, spread and potential outliers.

  • 05

    Use dataset and aesthetic to frame the reader's task

  • 06

    Check mapping against geom before styling

  • 07

    Explain how scale changes the visible comparison

  • 08

    Audit facet without removing necessary context

Worked example · free

Test a distribution against tuning choices

Q [8 marks]. Use the eight suggested points only to self-check this AskSia example; they are not Monash assessment marks. Use the eight suggested points only to self-check this AskSia example; they are not Monash assessment marks. Use the eight suggested points only to self-check this AskSia example; they are not Monash assessment marks. AskSia-authored practice; the point allocation is a study aid, not a University marking scheme. Delivery times are 8, 9, 9, 10, 11, 12, 25 and 26 minutes, with two high observations separated from the main group.
  • 3List the raw observations before selecting a distribution display.
  • 2Compute the total and mean, noting the high pair that shifts the centre.
  • 1Pair smoothing with a rug or boxplot so individual evidence remains recoverable.
  • 2Compare at least two tuning choices before describing modes or outliers.
The total is 110 and the mean is 13.75 minutes. The central cluster lies from 8 to 12, so a rug should accompany any smoothed display. Show the raw rug beside any smoothing because the mean of 13.75 is pulled upward by 25 and 26; a claimed second mode should survive reasonable tuning choices. Show the raw rug beside any smoothing because the mean of 13.75 is pulled upward by 25 and 26; a claimed second mode should survive reasonable tuning choices. Show the raw rug beside any smoothing because the mean of 13.75 is pulled upward by 25 and 26; a claimed second mode should survive reasonable tuning choices.
Sia tip — Change bin width or bandwidth deliberately and explain which feature survives the sensitivity check.
Glossary

Key terms

Aesthetic mapping
A variable-to-channel connection declared inside the plotting grammar, such as value to vertical position.
Geometric layer
A mark type used to draw observations or summaries, including points, bars, lines and boxplots.
Bin width
The interval used to pool observations into each histogram rectangle.
Bandwidth
The smoothing parameter controlling how local or broad a density estimate appears.
FAQ

Grammar of Graphics and Basic Plots FAQ

How do bin width and bandwidth alter a distribution?

Bin width changes which observations are pooled into histogram bars, while bandwidth changes the smoothing of a density estimate. Both can reveal or conceal structure, so conclusions should survive several defensible settings.

Which display should accompany a density curve?

A rug or another raw-observation layer helps readers see the evidence that smoothing compresses. Histograms and boxplots provide complementary summaries. The best companion depends on the question, but the underlying observations should remain recoverable when bandwidth choices could alter apparent peaks.

What makes a bin width defensible?

A defensible width reveals relevant structure without manufacturing gaps or merging substantively different values, and the conclusion remains similar under nearby reasonable widths. Report the choice when it materially affects interpretation and compare with raw marks rather than treating the default as neutral.

Why compare a histogram with a rug?

The histogram shows pooled counts while the rug preserves exact observation locations. Reading them together reveals whether a gap or cluster comes from the data or from bin boundaries. Nearby bin widths should be tried when the conclusion depends on a particular partition, and any unstable feature should be reported cautiously.

Study strategy

Exam move

Draw the same numeric vector as a rug, histogram, density estimate and boxplot. Recalculate the mean, vary bin width and bandwidth, and note which apparent features persist. For each display, name the perceptual task it supports and one feature it suppresses. A final paragraph should distinguish a robust distributional observation from a tuning-sensitive impression.

Working through Grammar of Graphics and Basic Plots in ETF5922? Sia is AskSia’s AI Computer Science tutor — ask any ETF5922 Grammar of Graphics and Basic Plots question and get a clear, step-by-step explanation grounded in how ETF5922 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 101 of your Monash University subjects - and 1,000+ Bibles across every Australian university.
Sia - your ETF5922 tutor, unlimited, worked the way the exam marks it
The full 4-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
ETF5922 · Data visualisation and communication - independent study guide on the AskSia Library. More Monash University subjects · Microeconomics across all universities