Encodings

Learn about the different types of encoding channels and implement a practical example.

Altair uses encodings to specify where to represent data. To implement an encoding, Altair defines the concept of an encoding channel. Encoding channels are the building blocks of a visualization. Altair uses encoding channels to translate data from a raw representation in a dataset, such as a DataFrame, to the final visualization. The encoding process dictates how that data appears in the chart based on the selected channel type.

Main types of channels

Altair defines the following main types of channels:

  • Position: This defines the position of data in the chart.

  • Mark property: This defines how to render the style of the chart, including colors, size, and more.

  • Text and Tooltip: These define additional annotations for the graph.

Position channels

Altair supports the following position channels:

Get hands-on with 1200+ tech skills courses.