matplotlib / matplotlib/mpl-altair
Add timeUnit support
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
mpl-altair currently doesn't support conversion for Altair charts that use timeUnit aggregations.
Code for reproduction
This and other timeUnit transformations don't work:
from vega_datasets import data
seattle = data.seattle_weather()
chart = alt.Chart(seattle).mark_point().encode(
alt.X('month(date)'), alt.Y('temp_max')
)
mplaltair.convert(chart)
Actual outcome
A NotImplementedError is raised for anything that has a timeUnit.
Expected outcome
Any plot with a timeUnit transformation should work.
This plot should look something like this:

Possible solution and notes
- Manipulate the data in
parse_chart.ChannelMetadata()so that the data reflects the timeUnit aggregation. (seeparse_chart.ChannelMetadata._handle_timeUnit().) - Also note that timeUnit transformations can also be applied separately from timeUnit transformations in the encoding channel.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction using the Seattle weather dataset and inspect parse_chart.ChannelMetadata(), especially _handle_timeUnit(), where the issue identifies the current limitation. Check how timeUnit is represented in channel encoding and how separate timeUnit transformations are handled. Done means the reproduction and other timeUnit transformations convert without NotImplementedError and produce the expected time-based plot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100