Skip to content

Bug when rendering grid::radialGradient() #198

@teunbrand

Description

@teunbrand

In the image below, I'd have expected the outside to be green, and a smooth interpolation between "tomato" and "dodgerblue" (instead of the sudden switch from magenta to blue).

library(grid)

colours <- c("tomato", "dodgerblue", "limegreen")

radial <- radialGradient(colours, group = FALSE)
rect <- rectGrob(gp = gpar(fill = radial))

temp <- tempfile(fileext = ".png")
ragg::agg_png(temp)

grid.newpage()
grid.draw(rect)

dev.off()
#> png 
#>   2
knitr::include_graphics(temp)

Created on 2025-08-08 with reprex v2.1.1

Expected image (with png(type = "cairo")):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions