Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aggregate support #32

Open
kdorr opened this issue Aug 16, 2018 · 0 comments
Open

Add aggregate support #32

kdorr opened this issue Aug 16, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@kdorr
Copy link
Collaborator

kdorr commented Aug 16, 2018

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:

aggregates_altair

The second chart should look something like this:

aggregates_altair_count

Possible solution

During the initial altair chart parsing, manipulate the data to include the aggregations. See parse_chart.ChannelMetadata() (specifically _aggregate_channel()).

@kdorr kdorr added the enhancement New feature or request label Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant