ggtile                package:ggplot                R Documentation

_G_r_o_b _f_u_n_c_t_i_o_n: _t_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Add tiles to a plot

_U_s_a_g_e:

     ggtile(plot = .PLOT, aesthetics=list(), ..., data=plot$data)

_A_r_g_u_m_e_n_t_s:

    plot: the plot object to modify

aesthetics: named list of aesthetic mappings, see details for more
          information

     ...: other options, see details for more information

    data: data source, if not specified the plot default will be used

_D_e_t_a_i_l_s:

     The tile grob will tile the plot surface as densly as possible,
     assuming that every tile is the same size.  It is similar to
     'levelplot' or 'image'.

     Aesthetic mappings that this grob function understands:

        *  x: x position (required)

        *  y: y position (required)

        *  width: width of the rectangle

        *  height: height of the rectangle

        *  fill: fill colour (see 'sccolour)'

     These can be specified in the plot defaults (see 'ggplot') or in
     the 'aesthetics' argument.  If you want to modify the position of
     the points or any axis options, you will need to add a position
     scale to the plot.  These functions start with 'ps', eg.
     'pscontinuous' or 'pscategorical'

     Other options:

        *  none

_A_u_t_h_o_r(_s):

     Hadley Wickham <h.wickham@gmail.com>

_S_e_e _A_l_s_o:

     'ggrect', 'resolution'

_E_x_a_m_p_l_e_s:

     pp <- function (n,r=4) {
     x <- seq(-r*pi, r*pi, len=n)
     df <- expand.grid(x=x, y=x)
     df$r <- sqrt(df$x^2 + df$y^2)
     df$z <- cos(df$r^2)*exp(-df$r/6)
     df
     }
     p <- ggplot(pp(20), aes=list(x=x,y=y))
     ggtile(p) #pretty useless!
     ggtile(p, list(fill=z))
     ggtile(p, list(height=abs(z), width=abs(z)))
     ggtile(ggplot(pp(100), aes=list(x=x,y=y,fill=z)))
     ggtile(ggplot(pp(100, r=2), aes=list(x=x,y=y,fill=z)))
     p <- ggplot(pp(20)[sample(20*20, size=200),], aes=list(x=x,y=y,fill=z))
     ggtile(p)

