我试图在altair中水平连接两个图表,但我无法让它们看起来像我想要的那样
下面是它们的样子:
下面是我使用的代码:
pick_ausbildung = alt.selection_single(fields = ["Ausbildungsstand"], on = "mouseover")
ausbildung_chart = alt.Chart(umfrage,
title = "Ausbildungsstand").mark_bar().encode(
y=alt.Y("Ausbildungsstand", axis = alt.Axis(title = None)),
x="count()",
color = alt.condition(pick_ausbildung,
alt.Color("Ausbildungsstand:N",
legend = None), alt.value("lightgrey")),
tooltip = ["Ausbildungsstand","count()"]).properties(height=200).add_selection(pick_ausbildung)
g_ausbildung_chart = alt.Chart(umfrage).mark_bar().encode(
x="Geschlecht",
y="count()",
color = "Geschlecht",
tooltip = ["Geschlecht","count()"]).properties(width=300).transform_filter(pick_ausbildung)
ausbildung_chart|g_ausbildung_chart
基本上,我想把图表“AuxBurdgsStand”放在图表区域的中间。我的意思是,我想把它从画布的顶部边缘分开我可以通过调整图表的高度得到我想要的结果(如果它们的高度相同,那么它们是对齐的),但是我想知道如何在“画布”中移动图表
提前感谢您的帮助
您可以使用^{} 函数并传递
center=True
。例如:相关问题 更多 >
编程相关推荐