简体   繁体   中英

how add a new axis with differenct scale (parallel with y axis) in altair

base = alt.Chart(df).encode(alt.X('monthdate(date):O'))
line = base.mark_line(color='red').encode(y = 'something:Q')
bar = base.mark_bar().encode(y = 'otherthing:Q')
(line+bar)

i'm trying to plot two variable in each date, problem is the scale of "something" and "otherthing" is different(one varies 1-100 other varies 1-2000000000) so i can't see changes of one of them in chart(one of them become a smooth line) what can i do?

a third axis parallel with y axis with other scales is a good solution how can i do that?

Use

(line + bar).resolve_scale(y='independent')

More information at Altair: Scale and Guide Resolution

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM