Reputation: 65
I am trying to add the third y axis to the altair plots It's easy to do this with just two y axis.
base = alt.Chart(df).encode(alt.X('time'))
a = base.mark_line(opacity=0.6).encode(alt.Y('price'), color='green')
b = base.mark_point(opacity=0.6).encode(alt.Y('markout'), color='blue')
c = alt.layer(a, b).resolve_scale(y='independent')
But if I use this method adding the third y axis
c = base.mark_line(opacity=0.6).encode(alt.Y('size'), color='lightgrey')
d = alt.layer(a,b,c).resolve_scale(y='independent')
The y axis will overlay on the right.
Is there a way to add the third axis on the right of the second? Something like this
Upvotes: 0
Views: 535
Reputation: 38922
You can offset the axis for the third plot. For example
c = (
base.mark_line(opacity=0.6)
.encode(
alt.Y('size', axis=alt.Axis(offset=40)),
color='lightgrey'
)
)
Upvotes: 1