Marks

The chart encoding maps data columns to visual plot attributes; the mark property specifies how those attributes should be represented. Altair provides a number of mark properties:

TODO: fill-in examples

Mark Name Method Description Example
area mark_area() A filled area plot. Area Chart
bar mark_bar() A bar plot. Aggregate Bar Chart
circle mark_circle() A scatter plot with filled circles. Gapminder Bubble Plot
line mark_line() A line plot. Multi Series Line Chart
point mark_point() A scatter plot with configurable point shapes. Binned Scatterplot
rule mark_rule() A vertical or horizontal line spanning the axis.  
square mark_square() A scatter plot with filled squares.  
text mark_text() A scatter plot with points represented by text Colored Text Scatter Plot
tick mark_tick() A vertical or horizontal tick mark. Strip Plot

In Altair, marks can be most conveniently specified by the mark_* methods of the Chart object, which take optional keyword arguments that are passed to MarkConfig to configure the look of the marks. For example, the following uses mark_circle() to represent points as red semi-transparent filled circles:

from altair import Chart

url = 'https://vega.github.io/vega-datasets/data/cars.json'

Chart(url).mark_circle(
    color='red',
    opacity=0.3
).encode(
    x='Horsepower:Q',
    y='Miles_per_Gallon:Q'
)