有没有一种方法可以在Altair中创建水平条形图,而无需使用特殊类型的编码或聚合?

问题描述

我想创建一个水平条形图,如下面的代码所示,而不必在alt.X()规范中使用“普通”变量类型或聚合。这可能吗?

import altair as alt
from vega_datasets import data

source = data.wheat()

bars = alt.Chart(source).mark_bar().encode(
    x='wheat:Q',y="year:O"
)

text = bars.mark_text(
    align='left',baseline='middle',dx=3  # Nudges text to right so it doesn't appear on top of the bar
).encode(
    text='wheat:Q'
)

(bars + text).properties(height=900)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)