You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have 2 y axis where the units are different. However, it seems altair is removing the ticks of the second y axis. Probably because the plot is overlapping
is there a way around this?
import altair as alt
from vega_datasets import data
source = data.cars()
base = alt.Chart(source).encode(x='year(Year):T')
line_A = base.mark_line(color='#5276A7').encode(
alt.Y('average(Horsepower):Q').axis(titleColor='#5276A7',title='Horsepower')
)
line_B = base.mark_line(color='#F18727').encode(
alt.Y('average(Horsepower)/100:Q').axis(title="Percentage",titleColor='#F18727')
)
alt.layer(line_A, line_B).resolve_scale(y='independent')
The text was updated successfully, but these errors were encountered:
It's because you can't do the computation inside the encoding, is need to be in a transform_calculate (only some aggregate computation are supported directly in the encoding string). If you remove /100 you get this which sounds like what you want?
I would like to have 2 y axis where the units are different. However, it seems altair is removing the ticks of the second y axis. Probably because the plot is overlapping
is there a way around this?
The text was updated successfully, but these errors were encountered: