Skip to content

Instantly share code, notes, and snippets.

@mroswell
Created October 18, 2017 18:05
Show Gist options
  • Save mroswell/09595513bcdf2a2103805cc83e18f8b2 to your computer and use it in GitHub Desktop.
Save mroswell/09595513bcdf2a2103805cc83e18f8b2 to your computer and use it in GitHub Desktop.
Altair new documentation draft

New Examples

Data Type Shorthand Code Description
quantitative Q a continuous real-valued quantity
ordinal O a discrete ordered quantity
nominal N a discrete unordered category
temporal T a time or date value
.. altair-plot::

 from altair import Chart, load_dataset, enable_mime_rendering, X, Axis

    # load built-in dataset as a pandas DataFrame
    barley = load_dataset('barley')

    # Uncomment for rendering in JupyterLab & nteract
    # enable_mime_rendering()

    Chart(barley).mark_bar(barSize=15).encode(
        x=X('year:T',
            timeUnit='year',
            axis=Axis(labelAngle=320,
                      labelBaseline="bottom",
                      labelAlign="right",
                      tickPadding=10,
                      ticks=2)),
        y='sum(yield):Q',
        color='site:N'
    ).configure_cell(
    height=200,
    width=110)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment