[R] plot background - excel gradient style background ?

baptiste auguie baptiste.auguie at gmail.com
Sat Jun 30 06:02:29 CEST 2012


Looking at these, and in retrospect, if I were writing a manuscript of
the pre-digital age, I would definitely add a burning mark as a
finishing touch to complete the work. Perhaps waving the parchment
above a burning candle.

With modern digital support, you can fake a similar result using e.g.
grid.raster or rasterImage, as others have said before.

library(grid)
g <- rasterGrob(blues9, width=unit(1,"npc"), height = unit(1,"npc"),
interpolate = TRUE)
# grid.draw(g)

library(ggplot2)
ggplot(mtcars, aes(factor(cyl))) + # add gradient background
   annotation_custom(g, xmin=-Inf, xmax=Inf, ymin=-Inf, ymax=Inf) +
   geom_bar() # add data layer

baptiste


On 30 June 2012 09:07, jcrosbie <james at crosb.ie> wrote:
> I have a number of different figures I wish to create with a gradient
> background. In addition to the two examples I've uploaded I need a boxplot,
> histogram, etc.
>
>
> http://r.789695.n4.nabble.com/file/n4634932/fig1.png fig1.png
> http://r.789695.n4.nabble.com/file/n4634932/fig2.png fig2.png
>
> --
> View this message in context: http://r.789695.n4.nabble.com/plot-background-excel-gradient-style-background-tp4632138p4634932.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list