In altair, how do I make a histogram without altering the axis ticks? When I try to bin the data, the axis ticks no longer extend past the data in the histogram. I would prefer the bins and axis ticks be calculated separately.
The below code is a simple example attempting to show limits of an in-tolerance region for a measurement to see how many measurements pass vs fail.
import numpy as np
import pandas as pd
import altair as alt
nominal = 0.500
tolerance = 0.011
limits = pd.DataFrame({'x_limits' : [nominal - tolerance, nominal + tolerance]})
data = pd.DataFrame({'x_data' : np.random.normal(0.520, 0.002, 100)})
layers = []
layers.append(alt.Chart(data)
.mark_bar()
.encode(x = alt.X('x_data', bin = alt.Bin(nice = False)), y = 'count()'))
layers.append(alt.Chart(limits)
.mark_rule()
.encode(x = 'x_limits'))
chart = alt.layer(*layers)
The output shows ticks on the X axis only under the histogram bins and they stop well before the rules at the tolerance limits.
