kankan256
kankan256

Reputation: 250

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?

Upvotes: 1

Views: 88

Answers (1)

jakevdp
jakevdp

Reputation: 86310

Use

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

More information at Altair: Scale and Guide Resolution

Upvotes: 1

Related Questions