Course contentsShow
← Data Science
Lesson 1344 of 2,14534. Visualization with R and ggplot2Free lesson

Scales and Coordinate Systems

Controlling how data values map to visual space through scales and transforming plot dimensions with coordinates.

Scales and Coordinate Systems

You'll learn how scales control the translation between your data and visual space, and how coordinate systems reshape your plot's dimensions.

Understanding Scales

Think of scales as translators between your data world and the visual world. When you map a variable to color, position, or size, a scale determines exactly how each data value becomes a visual property.

For example, if your dataset has temperatures from 0°C to 100°C, a position scale decides where "0" and "100" appear on your axis. A color scale determines which colors represent low vs. high temperatures. Scales handle:

  • Continuous data: mapping numeric ranges to positions or gradients
  • Discrete data: assigning categories to distinct colors or positions
  • Transformations: applying log, square root, or other math before display
  • Limits and breaks: controlling what range displays and where tick marks appear

Every aesthetic mapping you create has an associated scale, even if you don't explicitly customize it.

Coordinate Systems

While scales control what appears, coordinate systems control how the plotting space itself is structured. The default Cartesian system (standard x-y grid) works for most cases, but alternatives reshape your entire visualization:

  • Polar coordinates: transform bar charts into pie charts or create radial plots
  • Flipped coordinates: swap x and y axes for horizontal layouts
  • Fixed aspect ratios: ensure equal spacing (crucial for maps)
  • Transformed coordinates: apply mathematical transformations to the entire space

Coordinate systems don't change your data—they change how the geometric objects are rendered in 2D space.

Key Takeaway: Scales are the bridges between data values and visual properties (position, color, size), while coordinate systems define the geometric space where your plot lives—master both to gain complete control over how your visualizations represent reality.