altair-viz / altair-transform

Evaluation of Vega-Lite transforms in Python
MIT License
70 stars 8 forks source link

Support data generators #23

Closed jakevdp closed 5 years ago

jakevdp commented 5 years ago

For example, this should work:

import altair as alt

chart = alt.Chart(
    {"sequence": {"start": -4, "stop": 4, "step": 0.1, "as": "x"}}
).transform_calculate(
    y="densityNormal(datum.x, 0, 1)"
).mark_line().encode(
    x='x:Q',
    y='y:Q'
)

from altair_transform import extract_data
extract_data(chart)