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 geom_raster and geom_hexbin #60

Open
Vindaar opened this issue Apr 6, 2020 · 1 comment
Open

Add geom_raster and geom_hexbin #60

Vindaar opened this issue Apr 6, 2020 · 1 comment

Comments

@Vindaar
Copy link
Owner

Vindaar commented Apr 6, 2020

geom_raster would be handy for heatmaps with many tiles. The current approach of drawing a single rectangle for each tile is extremely wasteful for large heatmaps, which essentially represent bitmaps.

We should attempt to utilize cairo rastering to implement this. As far as I understand it, cairo raster gets two callbacks to determine the color for each pixel.

Essentially we provide a proc, which calculates the color of each pixel in the main plot viewport in (I assume) global coordinates.

If this works out, we can think about implementing geom_hexbin as well. However, in order to support hex binning two dimensional data, we need a histogram proc for hex bins. But essentially if the hex size is known the computation of that is rather simple.

@Vindaar
Copy link
Owner Author

Vindaar commented Jul 10, 2020

geom_raster has been implemented in #84.

What still is broken is using geom_raster with bin / count statistics. This is almost a requisite for geom_hexbin, because I assume almost no one would calculate a hex bin statistics manually. Drawing the hex bin is reasonably easy. Might be a good idea at that point to move some of the raster logic from ginger back to ggplotnim, so that a ginger backend only has to draw a finished bitmap without and logic attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant