liveBook · Manning

Discrete variable

As explained in D3.js in Action, Third Edition

A discrete value belongs to a predetermined finite or otherwise distinct set of possible values.

A discrete variable takes values from a distinct, predetermined set. In quantitative data, its values are whole numbers that can be counted but not subdivided; employee counts are discrete, whereas temperature is continuous. section 3.1.2

Use the distinction to plan visualizations and scales:

  • Treat counts such as employees, students, or monthly letters as discrete quantitative values. section 3.1.2 section 14.2
  • Treat categories such as genres, coffee sizes, or genders as discrete values when each item belongs to one defined group. section 14.2 section 6.4.2
  • Choose visual encodings deliberately: discrete categories commonly use categorical colors, while discrete domains can map to continuous positions. section 3.1.2 section 6.4.2

Genres mapped to colors

A D3 scale can map the discrete genre domain ["Drama", "Action", "Crime", "Comedy"] to the discrete color range ["purple", "blue", "green", "yellow"]. section 3.4.1

Figure 3.4 A classification of data types
figure

The classification diagram places discrete data inside quantitative data and contrasts it with continuous data. section 3.1.2

How D3.js in Action, Third Edition covers it

How deep it goes
Defines countable whole numbers, contrasts them with continuous measurements, and extends the idea to discrete scale inputs and outputs.
Examples
Uses employee counts, coffee sizes, TV genres, and gender categories as discrete values in charts and scales.
What it assumes
Builds the distinction from familiar numerical and categorical examples rather than assuming mathematical formalism.
What you can do after
Apply it via D3 scales to choose discrete domains, categorical outputs, or continuous positions for chart variables.
How it connects
Connects quantitative data, continuous data, qualitative data, categorical color scales, and D3 scales.

Also explained in

Compare how 5 books explain discrete variable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of D3.js in Action, Third Edition. The section links point to the parts of the book it draws on.