Open
Description
mpl-altair currently doesn't support conversion for Altair charts that use aggregations.
Code for reproduction
data:
df = pd.DataFrame({
'a': [1, 1, 2, 3],
'b': [1.1, 2.2, 3.3, 4.4]
})
Example 1:
chart = alt.Chart(df).mark_point().encode(
alt.X('a'), alt.Y('average(b)')
)
mplaltair.convert(chart)
Example 2:
chart = alt.Chart(df).mark_point().encode(
alt.X('a'), alt.Y('count()')
)
mplaltair.convert(chart)
Actual outcome
A NotImplementedError
is raised for anything that has aggregated data.
Expected outcome
Any plot with aggregation should work.
The first chart should look something like this:
The second chart should look something like this:
Possible solution
During the initial altair chart parsing, manipulate the data to include the aggregations. See parse_chart.ChannelMetadata()
(specifically _aggregate_channel()
).