[R] [FORGED] help with gradient boxplot

Paul Murrell paul at stat.auckland.ac.nz
Thu Dec 8 23:24:52 CET 2016


Hi

You could try ...

grid.export(..., strict=FALSE)

... and/or install the latest gridSVG version from R-Forge ...

https://r-forge.r-project.org/R/?group_id=1025

Paul

On 09/12/16 11:13, Fix Ace wrote:
> Hi, Paul,
>
> Thank you very much for your reply. I tried your sample code, but did
> not get gradient filling (still empty box). And many warnings:
> 1: In checkAttrs(attrs, eltName) :
>   Removing non-SVG attribute name(s): fill, fill-opacity
> 2: In checkAttrs(attrs, eltName) :
>   Removing non-SVG attribute name(s): fill, fill-opacity
> 3: In checkAttrs(attrs, eltName) :
>   Removing non-SVG attribute name(s): fill, fill-opacity
> 4: In checkAttrs(attrs, eltName) :
>   Removing non-SVG attribute name(s): fill, fill-opacity
> 5: In checkAttrs(attrs, eltName) :
> .
> .
> .
>
> I saw the figure in an article, and so I don't have to script. I am
> actually trying to generate the similar figure for my own data.
>
> Any other thoughts?
>
> Thanks.
>
> Ace
>
>
> On Tuesday, December 6, 2016 7:43 PM, Paul Murrell
> <paul at stat.auckland.ac.nz> wrote:
>
>
> 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 <mailto: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
> <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 <mailto:paul at stat.auckland.ac.nz>
> http://www.stat.auckland.ac.nz/~paul/
>
>
>

-- 
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