liveBook · Manning

Marks section

As explained in Data Storytelling with Altair and AI

A marks section is the part of a Vega specification that defines graphical marks, their data source, encoding, and visual styling.

A marks section defines the visual shapes that represent data in a Vega visualization. Each mark specifies a type, data source, encoding, and initial visual properties. section 3.1.1

A line mark

A line mark can read from myData, map x and y fields through xScale and yScale, and set its stroke color to red. section 3.1.1

Listing 3.5 An example marks section
"marks": [
    {
      "type": "line",
      "from": {"data": "myData"},
      "encode": {
        "enter": {
          "x": {"scale": "xScale", "field": "x"},
          "y": {"scale": "yScale", "field": "y"},
          "stroke": {"value": "red"}
        }
      }
    }
  ],

Inspect the complete marks definition for the line chart, including type, data source, encoding channels, scales, and stroke styling. section 3.1.1

Configure each mark by specifying:

  • A mark type, such as line, symbol, or rect. section 3.1.1
  • A data source through the from property. section 3.1.1
  • Encoding channels such as x, y, and color. section 3.1.1
  • Initial properties in the enter block, including size, color, opacity, or shape. section 3.1.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Specifies mark type, data source, encoding, and initial properties without detailing broader visualization construction.
Examples
Uses a line chart backed by myData with x and y encodings and a red stroke.
What it assumes
Assumes familiarity with Vega data and scales while identifying the mark properties needed for a basic chart.
What you can do after
Build a Vega mark definition that maps data fields to visual channels and styles the resulting shapes.
How it connects
Connects data sections, scales, axes, and signals to visual representation and interaction.

This explainer was generated by Manning's knowledge graph from the text of Data Storytelling with Altair and AI. The section links point to the parts of the book it draws on.