Skip to content

Should geom_raster() fall back to geom_rect() under non-linear coordinates? #5503

Closed
@teunbrand

Description

@teunbrand

The following code fails:

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.3.1

ggplot(faithfuld, aes(eruptions, waiting, fill = density)) +
  geom_raster() +
  coord_polar()
#> Error in `geom_raster()`:
#> ! Problem while converting geom to grob.
#> ℹ Error occurred in the 1st layer.
#> Caused by error in `draw_panel()`:
#> ! `geom_raster()` only works with `coord_cartesian()`

Created on 2023-10-30 with reprex v2.0.2

While it shouldn't be too far-fetched to use geom_rect()'s drawing method to render this under non-linear coordinate systems. We could throw an informative message saying that we cannot render the data as a raster.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions