Reputation: 4521
I'm trying to set tickMinStep
for the x-axis in altair
so that the tick marks occur every two instead of every one.
Here's the documentation where I found the tickMinStep
parameter.
https://altair-viz.github.io/user_guide/generated/core/altair.Axis.html
This is the example code I'm working with:
import altair as alt
from vega_datasets import data
source = data.movies.url
chart = alt.Chart(source).mark_bar().encode(
alt.X('IMDB_Rating:Q', axis=alt.Axis(title='Rating')),
alt.Y('count()',title="Number of Movies"),
)
Both of these ways fail to set tickMinStep
, and return SchemaValidationError: Invalid specification
. Any ideas why these fail?
1:
chart.configure_axisX(tickMinStep=2)
2:
chart = alt.Chart(source).mark_bar().encode(
alt.X('IMDB_Rating:Q', axis=alt.Axis(title='Rating', tickMinStep=2)),
alt.Y('count()',title="Number of Movies"),
)
Upvotes: 1
Views: 2732
Reputation: 86310
The first method doesn't work because tickMinStep
is not a configurable option (it is not one of the arguments supported by alt.AxisConfig
).
The tickMinStep
option was added to alt.Axis
in Altiar version 3.0, so trying to use it with older Altair versions will lead to a the schema error you're seeing. Update your Altair installation and your second code block should work without problems.
Upvotes: 3