This PR finally adds geom_raster to create heatmaps / tile maps with many elements without any performance / file size problems.
Still WIP. To be done:
[x] add fields for width, height to gkRaster. Required after all of course, width can be something different from 1, can use same field as for gkTile
[x] better handle the assignment of the data / color information to the drawing callback. Complication is that coordinate system in cairo obviously is top to bottom. Currently fill data in y from end to beginning. Works, but fragile, since it we currently require the positions to be integers.
[x] add a recipe making use of raster
Note that while geom_raster is significantly faster than geom_tile, it is still held back performance wise, because it is treated as a normal geom. This means a large part of the code path is not actually required for this geom. Especially the mapping of the z values to colors still happens via a callback, which is then evaluated and stored intermittently in a ScaleValue and GgStyle. This is done for all geoms to achieve maximum flexibility, but a waste of resources for this geom.
But instead of special casing this case I'd rather eventually provide a fast code path for simple plots, which have all information available without any computations.
This PR finally adds
geom_raster
to create heatmaps / tile maps with many elements without any performance / file size problems.Still WIP. To be done:
gkRaster
. Required after all of course, width can be something different from 1, can use same field as forgkTile
Note that while
geom_raster
is significantly faster thangeom_tile
, it is still held back performance wise, because it is treated as a normal geom. This means a large part of the code path is not actually required for this geom. Especially the mapping of thez
values to colors still happens via a callback, which is then evaluated and stored intermittently in aScaleValue
andGgStyle
. This is done for all geoms to achieve maximum flexibility, but a waste of resources for this geom.But instead of special casing this case I'd rather eventually provide a fast code path for simple plots, which have all information available without any computations.