I have a bar chart which shows percentage values for several languages.
chart = alt.Chart(df_lang_perc).mark_bar().encode(
x=alt.X('Lang:N', sort='-y', title='Language'),
y=alt.Y('perc_pos:Q', title='Percentage of Positive Reviews', scale=alt.Scale(domain=[0.7,1]), axis=alt.Axis(format='%')),
)
chart.display()
In the DataFrame, each language is categorized into a market. When I try to add color by language, Altair has a bug cropping the bars to the correct length.
chart = alt.Chart(df_lang_perc).mark_bar().encode(
x=alt.X('Lang:N', sort='-y', title='Language'),
y=alt.Y('perc_pos:Q', title='Percentage of Positive Reviews', scale=alt.Scale(domain=[0.7,1]), axis=alt.Axis(format='%')),
color=alt.Color('market')
)
chart.display()
Is this a know issue and is there a workaround?
Minimal reproducible example:
df_lang_perc = pd.DataFrame({
'Lang': ['brazilian', 'czech', 'english', 'latam', 'thai'],
'perc_pos': [0.936053, 0.906603, 0.881611, 0.918832, 0.904748],
'market': ['Latin_America', 'Europe', 'Emglish', 'Latin_America', 'Asia']
})

