带最小/最大须须的箱型图#

此示例展示了如何使用2000年的美国人口数据制作箱形图。 注意extent属性的默认值为1.5, 这表示将须条延伸到距离第一四分位数和第三四分位数1.5 * IQR范围内的最远点的惯例。

import altair as alt
from vega_datasets import data

source = data.population.url

alt.Chart(source).mark_boxplot(extent='min-max').encode(
    x='age:O',
    y='people:Q'
)
import altair as alt
from vega_datasets import data

source = data.population.url

alt.Chart(source).mark_boxplot(extent='min-max').encode(
    x='age:O',
    y='people:Q'
)
# No channel encoding options are specified in this chart
# so the code is the same as for the method-based syntax.