经验累积分布函数#
此示例显示了一个经验累积分布函数。
import altair as alt
from vega_datasets import data
source = data.movies.url
alt.Chart(source).transform_window(
ecdf="cume_dist()",
sort=[{"field": "IMDB_Rating"}],
).mark_line(
interpolate="step-after"
).encode(
x="IMDB_Rating:Q",
y="ecdf:Q"
)
import altair as alt
from vega_datasets import data
source = data.movies.url
alt.Chart(source).transform_window(
ecdf="cume_dist()",
sort=[{"field": "IMDB_Rating"}],
).mark_line(
interpolate="step-after"
).encode(
x="IMDB_Rating:Q",
y="ecdf:Q"
)
# No channel encoding options are specified in this chart
# so the code is the same as for the method-based syntax.