I am trying to plot a chart in Altair using the below code.
tot_matches_played = alt.Chart(mpt).mark_bar().encode(
alt.X('Team',axis=alt.Axis(title='Teams Played in IPL'), sort=alt.EncodingSortField(field='Number_of_matches_played:Q', op='count', order='ascending')),
alt.Y('Number_of_matches_played:Q' ),
tooltip=['sum(Number_of_matches_played)']
)
But since the tooltip name is weird, I would like to rename it on the chart using "as", something like below.
tot_matches_played = alt.Chart(mpt).mark_bar().encode(
alt.X('Team',axis=alt.Axis(title='Teams Played in IPL'), sort=alt.EncodingSortField(field='Number_of_matches_played:Q', op='count', order='ascending')),
alt.Y('Number_of_matches_played:Q' ),
tooltip=['sum(Number_of_matches_played)' as total_matches]
)
How to rename a tooltip so that it would appear in a more readable way to users looking at the chart.