I want to align al charts generated in a loop, but x axis do not start at the same vertical line, because of the 'y' labels. See below:
for campo in [col for col in nomina.columns if col!= 'Fecha ingreso']:
a = alt.Chart(nomina[[campo]]).mark_bar().encode(
x='count(' + campo + '):Q',
y=alt.Y('' + campo + ':N', sort='-x')
)
display(a.resolve_scale(x='shared'))
and I would like to see like this:
already figured it out. I just had to add charts in a list, then use alt.vconcat(mylistcharts)!
charts = []
for campo in [col for col in nomina.columns if col!= 'Fecha ingreso']:
a = alt.Chart(nomina[[campo]]).mark_bar().encode(
x='count(' + campo + '):Q',
y=alt.Y('' + campo + ':N', sort='-x')
)
charts.append(a.resolve_scale(x='shared'))
alt.vconcat(*charts)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.