我已经使用Python中的Altair库创建了一些数据的可视化。当前,悬停信息框显示中位数。如何更改聚合以显示均值?
答案 0 :(得分:2)
如果像https://altair-viz.github.io/gallery/boxplot.html中的示例那样谈论标准箱线图,则没有简单的方法将中位数更改为均值。这是因为中位数在基于其的vega-lite boxplot宏中进行了硬编码:https://vega.github.io/vega-lite/docs/boxplot.html
如果需要更大的灵活性,可以手动构造图表组件,并使用平均值而不是中位数;例如:
<ui:include src="/WEB-INF/includes/head.xhtml">
<ui:param name="description" value="Overridden description" />
</ui:include>