Extra tick not showing in the Altair bar chart
So I started with Altair, so far very intuitive, but I can't make an extra tick position to show, no matter what I do. My code looks like this:
alt.Chart(df3).mark_bar(opacity=0.8).encode(
x=alt.X('sname'
, sort='-y'
, axis=alt.Axis(title="",labelFontSize=16)),
y=alt.Y('W10',axis=alt.Axis(title="",titleFont=font
,labelFontSize=16, titleFontSize=30
,values=list(range(12))
,tickExtra=True
)),
color=alt.condition(
alt.datum.form=='Cold', # If the rating is 80 it returns True,
alt.value('#ff6666'), # and the matching bars are set as green.
# and if it does not satisfy the condition
# the color is set to steelblue.
alt.value('#003366')
)
).properties(width=700 #, height=700
).configure(
)
And I get something like this:
Column "W10" has the highest value of 9 in my dataset. But the max possible value is 10, and I would like to have that offset, that extra tick. But not matter what I do, it is not showing. I tried playing with various tick parameters, but no luck. Like now, I defined a range of 12, and I set "tickExtra=True" but not working.
Am I doing something wrong here, or it is kind of a bug?
Thanks!
To specify exact axis limits, you can use the domain property of the scale.
alt.Chart(cars).mark_point().encode(
alt.X('Acceleration:Q',
scale=alt.Scale(domain=(5, 20))
),
y='Horsepower:Q'
)
See: https://altair-viz.github.io/user_guide/customization.html#adjusting-axis-limits