R Under development (unstable) (2025-07-22 r88445 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(grid) > library(gridSVG) Attaching package: 'gridSVG' The following objects are masked from 'package:grid': linearGradient, pattern, radialGradient The following object is masked from 'package:grDevices': dev.off > > pdf(file = NULL) > > # Define a linear gradient > lg <- linearGradient(col = c("blue", "red")) > # Register it > registerGradientFill("lingrad", lg) > > # Do the same thing for radial gradient but also set the focus for the > # radial fill to be off-centre > rg <- radialGradient(fx = 0.3, fy = 0.3, + col = c("white", "black"), stops = c(0, 2)) > registerGradientFill("radgrad", rg) > > # Create rects that we are going to be gradient filling > grid.rect(x = 0.2, width = 0.2, height = 0.2, name = "linearfill") > grid.rect(x = 0.8, width = 0.2, height = 0.2, name = "radialfill") > > # Now apply the gradients > grid.gradientFill("linearfill", label = "lingrad", alpha = 0.7) > grid.gradientFill("radialfill", label = "radgrad") > > grid.export("gradient-test.svg") > dev.off() null device 1 > > proc.time() user system elapsed 0.62 0.04 0.65