I would like to format axis tick labels as percentage point.
import altair as alt
from vega_datasets import data
source = data.jobs.url
alt.Chart(source).mark_line().encode(
alt.X('year:O'),
alt.Y('perc:Q').axis(format='%'),
alt.Color('sex:N')
).transform_filter(
alt.datum.job == 'Welder'
)
So in the example above (taken from here), it should show the y-axis tick labels as '<value>%pt'
instead of <value>%
- is this possible to achieve?
If I understand you correctly, you want to add a pt
suffix to each label. You can do this via labelExpr
:
alt.Y('perc:Q').axis(labelExpr='100 * datum.value + "%pt"'),