A mark function specifies how Altair represents data visually. Calling mark_bar() on an Altair chart selects bars, while related functions select lines, areas, or points. section 2.1.2 section 3.2.2
Create a bar chart
Append mark_bar() to a chart before adding encodings: chart = alt.Chart(df).mark_bar(). The mark establishes the visual form; encodings then connect data columns to visual properties such as position. Mark properties supplied as arguments remain constant, whereas encoding channels can vary with column values. section 2.1.2 section 3.2.2
Use bars to answer a focused question
A regional homelessness chart uses mark_bar(color='#80C11E'), encodes territory on y and homeless-person counts on x, and sorts bars in descending order. The example also shows that absolute counts can mislead when regions have different populations, so the data may need normalization before charting. section 5.1.1
Listing 2.2 Mark in Altair
chart = alt.Chart(df).mark_bar()
View the minimal Altair statement that applies mark_bar() to a chart. section 2.1.2
