SCM

SCM Repository

[latticeextra] Annotation of /pkg/R/ggplot2like.theme.R
ViewVC logotype

Annotation of /pkg/R/ggplot2like.theme.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 165 - (view) (download)

1 : felix 157
2 :    
3 :     ## based on some of the default themes and scales used in ggplot2 by Hadley Wickham.
4 :    
5 : felix 158 ggplot2like.opts <- function()
6 :     {
7 :     list(default.args =
8 :     list(axis = axis.grid,
9 :     xscale.components = xscale.components.subticks,
10 : felix 165 yscale.components = yscale.components.subticks,
11 :     between = list(x = 0.4, y = 0.4))
12 : felix 158 )
13 :     }
14 :    
15 :     ggplot2like <-
16 : felix 157 function(..., n = 6, h = c(0,360) + 15, l = 65, c = 100,
17 :     h.start = 0, direction = 1,
18 :     low = "#3B4FB8", high = "#B71B1A", space = "rgb")
19 :     {
20 :     ## copied from ggplot2::scale_colour_hue
21 :     rotate <- function(x) (x + h.start) %% 360 * direction
22 :     if ((diff(h) %% 360) < 1) {
23 :     h[2] <- h[2] - 360 / n
24 :     }
25 :     colseq <-
26 :     hcl(h = rotate(seq(h[1], h[2], length = n)), c = c, l = l)
27 :     ## copied from ggplot2::scale_colour_gradient
28 :     ramp <- colorRampPalette(c(low, high), space = space, interpolate = "linear")(100)
29 :     theme <- custom.theme(symbol = colseq,
30 :     fill = colseq,
31 :     region = ramp)
32 :     ## based on ggplot2::theme_gray
33 :     theme <-
34 :     modifyList(theme,
35 :     list(axis.line = list(col = "transparent"),
36 :     axis.text = list(cex = 0.8, lineheight = 0.9, col = "grey50"),
37 :     panel.background = list(col = "grey90"),
38 : felix 158 reference.line = list(col = "white"),
39 : felix 157 strip.background = list(col = c("grey80", "grey70", "grey60")),
40 : felix 163 strip.shingle = list(col = c("grey60", "grey50", "grey40")),
41 : felix 165 strip.border = list(col = "transparent"),
42 : felix 157 add.text = list(cex = 0.8))
43 :     )
44 :     ## misc
45 :     theme <-
46 :     modifyList(theme,
47 :     list(plot.symbol = list(col = "black", pch = 19, cex = 0.6),
48 :     superpose.symbol = list(pch = 19, cex = 0.6),
49 :     plot.line = list(col = "black"),
50 :     plot.polygon = list(col = "grey20", border = "transparent"),
51 :     superpose.polygon = list(border = "transparent"),
52 :     box.dot = list(col = "grey20", pch = "|"),
53 :     box.rectangle = list(fill = "white", col = "grey20"),
54 : felix 158 box.umbrella = list(col = "grey20", lty = 1),
55 :     dot.line = list(col = "white"),
56 :     dot.symbol = list(col = "black", pch = 19))
57 : felix 157 )
58 :     ## custom over-rides
59 :     modifyList(theme, simpleTheme(...))
60 :     }

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge