Skip to content
Prev 365909 / 398502 Next

[FORGED] help with gradient boxplot

Hi

'gridSVG' might be one way to get this.  For example ...

library(lattice)
# Draw boxplot (with a package that sits on top of 'grid')
bwplot(voice.part ~ height, data=singer, xlab="Height (inches)",
        horizontal=FALSE)

library(grid)
grid.ls()
# Looks like boxes are called <blah>bwplot.box.polygon<blah>

library(gridSVG)
# Define linear gradient
fill <- linearGradient(c("blue", "red"),
                        x0=.5, x1=.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 "Rplots.svg"
# (where the gradient will actually be visible)
grid.export()

Does that help ?

Paul
On 07/12/16 09:14, Fix Ace wrote: