raster-aggregation in matplotlib extension
- Dominant language
- Python
- Stars
- 3.6k
- Forks
- 376
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 1
Description
#### Is your feature request related to a problem? Please describe.
I've already stated the problem on discourse [(here)](https://discourse.holoviz.org/t/how-to-use-raster-aggregation-with-matplotlib-extension/3754), but since it does not seem to get a lot of
attention there I thought I'll bring this up in a more general way on github as well.
I'm the dev of [EOmaps](https://github.com/raphaelquast/EOmaps), which already provides an integration for datashader via the matplotlib-extension.
While working on some improvements on the link between EOmaps and datashader, I've noticed
that at the moment, (at least as I understand it) the `dsshow` function of the matplotlib-extension
only allows for `bypixel` aggregations, which limits the capabilities quite a bit.
To be more precise, I've been trying to get "raster"-like aggregations (using for example "mode" reduction) working but
I could not find a way on how to do that without monkey-patching parts of the matplotlib-extension (see below)
#### Describe the solution you'd like
A clear and concise description of what you want to happen.
at the moment, the aggregation in `dsshow()` is implemented like this:
```python
canvas = Canvas(
plot_width=plot_width,
plot_height=plot_height,
x_range=x_range,
y_range=y_range,
)
binned = bypixel(self.df, canvas, self.glyph, self.aggregator)
```
however, as I understand it, a more flexible way would be to use something like
```python
canvas = Canvas(
plot_width=plot_width,
plot_height=plot_height,
x_range=x_range,
y_range=y_range,
)
# = "raster", "point", "line" etc.
# = "mean", "median", "max" etc.
agg = canvas.(, agg=)
binned = agg.compute()
```
This is just a scetch to clarify what I mean...
#### Describe alternatives you've considered
Well, I've managed to get raster-aggregation working in EOmaps by monkey-patching the `aggregate()` function of the matplotlib-extension, but I don't think that this is a proper (and sustainable) way to provide a better datashader-integration.
#### Additional context
here's what I intend to achieve (ideally without having to temper with the matpltolib-extension myself):

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the matplotlib-extension implementation of dsshow() and its aggregate() function, which the issue identifies as the current aggregation path. Compare that path with the requested raster-style aggregation and reduction options. Done means raster-like aggregations such as mode can be used through the matplotlib extension without monkey-patching it, including the EOmaps integration described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100