[R] [FORGED] help with gradient boxplot
Paul Murrell
paul at stat.auckland.ac.nz
Wed Dec 7 01:43:26 CET 2016
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:
> Hello, there,
> I will like to fill the boxplot with gradient color, as exampled below:
>
> Can anyone help me figure out what package I should go with?
> Thank you very much for any inputs!
> Kind regards,
> Ace
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list