I'm trying to horizontally concatenate two charts in altair, but I can't get them to look just like I want them to.
Here is what they look like:
And here is the code I'm using:
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
And basically, I would like to place the chart "Ausbildungsstand" in the middle of the chart area. I mean, I'd like to separate it from the top edge of the canvas.
I can sort of get the result I want by adjusting the height of the charts (if they have the same height, they're aligned), but I'd like to know how to move the chart inside the "canvas".
Thanks in advance for any help.
question from:
https://stackoverflow.com/questions/66067285/how-to-configure-chart-position-in-hconcatchart-in-altair 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…