library(gridSVG) library(lattice) library(grid) pdf(NULL) bwplot(voice.part ~ height, data=lattice::singer, xlab="Height (inches)", par.settings=list(box.rectangle=list(col="black"), box.umbrella=list(col="black"), plot.symbol=list(col="black"))) # grid.ls() # Looks like boxes are all called bwplot.box.polygon # Create linear gradient fill <- linearGradient(c("black", "white"), y0=.5, y1=.5, gradientUnits="coords") # Register gradient now so it applies to the whole page registerGradientFill("br", fill) # Fill each box with gradient grid.gradientFill("bwplot.box.polygon", label=rep("br", 17), grep=TRUE, group=FALSE) # Generate SVG version (where the gradient will actually show up) grid.export("Figures/export-lattice-gradientfill.svg") dev.off() system("inkscape --export-pdf=Figures/export-lattice-gradientfill.pdf Figures/export-lattice-gradientfill.svg") system("convert Figures/export-lattice-gradientfill.pdf Web/export-lattice-gradientfill.png")