I would like to bin values along one or both axes while also plotting on log scale. Is this possible? It seems like when I request both binning and log scale axis, the log scale is disabled:
import altair as alt
import numpy as np
data = pd.DataFrame( {col: np.random.random_sample(50) for col in 'xy'})
data += 1e-4
chart = alt.Chart( data ).mark_circle().encode(y='y')
naturalBin = chart.encode(
x = alt.X('x', bin=True, axis=alt.Axis(title = 'Binning, natural scale')))
log = chart.encode(
x = alt.X('x', bin = False, scale = alt.Scale(type='log'), axis=alt.Axis(title = 'No Binning, log scale')))
logBin = chart.encode(
x = alt.X('x', bin = True, scale = alt.Scale(type='log'), axis=alt.Axis(title = 'Binned, log scale')))
naturalBin & log & logBin

Hi @breadbaron – I don't think log-spaced bins are supported in Vega-Lite. In particular, it's not clear to me what the right binning would even be...
One way you could proceed is to precompute the log and bin that:
alt.Chart(data).transform_calculate(
logx = 'log(datum.x)/log(10)'
).mark_circle().encode(
alt.X('logx:Q', bin=True, title='log_10(x)'),
y='y:Q'
)

This is actually doable with some extra work.
See vega/vega-lite#4795 https://vega.github.io/vega-lite/examples/histogram_log.html for an example in Vega-Lite.
We may also improve this in the future -- see https://github.com/vega/vega-lite/issues/4792.
This would be nice to have - any updates on the altair side? Looks like it's not yet supported on the vega side.
@stephencwelch see https://vega.github.io/vega-lite/examples/histogram_log.html.
Most helpful comment
This would be nice to have - any updates on the altair side? Looks like it's not yet supported on the vega side.