Sha256: c6951ffe35671b910f20c8a7ec0cb486e612eec19e962ee9285b7223e3dcd359

Contents?: true

Size: 1.42 KB

Versions: 381

Compression:

Stored size: 1.42 KB

Contents

rbbt.require('ggplot2')

geom_entity <- function (real.geom = NULL, mapping = NULL, data = NULL, stat = "identity",
                          position = "identity", ...) {
    rg <- real.geom(mapping = mapping, data = data, stat = stat, 
                    position = position, ...)

    rg$geom <- proto(rg$geom, { 
        draw <- function(., data, ...) {
            grobs <- list()

            for (i in 1:nrow(data)) {
                grob <- .super$draw(., data[i,], ...) 
                if (is.null(data$entity.type)) 
                    grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
                else
                    grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
            }

            ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
        }

        draw_groups <- function(., data, ...) {
            grobs <- list()

            for (i in 1:nrow(data)) {
                grob <- .super$draw_groups(., data[i,], ...) 
                if (is.null(data$entity.type)) 
                    grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity)
                else
                    grobs[[i]] <- garnishGrob(grob, `data-entity`=data[i,]$entity, `data-entity-type`=data[i,]$entity.type)
            }

            ggplot2:::ggname("geom_entity", gTree(children = do.call("gList", grobs)))
        }
    })

    rg
}

Version data entries

381 entries across 381 versions & 1 rubygems

Version Path
rbbt-util-5.33.5 share/Rlib/plot.R
rbbt-util-5.33.4 share/Rlib/plot.R
rbbt-util-5.33.3 share/Rlib/plot.R
rbbt-util-5.33.2 share/Rlib/plot.R
rbbt-util-5.33.1 share/Rlib/plot.R
rbbt-util-5.33.0 share/Rlib/plot.R
rbbt-util-5.32.30 share/Rlib/plot.R
rbbt-util-5.32.28 share/Rlib/plot.R
rbbt-util-5.32.27 share/Rlib/plot.R
rbbt-util-5.32.26 share/Rlib/plot.R
rbbt-util-5.32.25 share/Rlib/plot.R
rbbt-util-5.32.24 share/Rlib/plot.R
rbbt-util-5.32.23 share/Rlib/plot.R
rbbt-util-5.32.22 share/Rlib/plot.R
rbbt-util-5.32.21 share/Rlib/plot.R
rbbt-util-5.32.20 share/Rlib/plot.R
rbbt-util-5.32.18 share/Rlib/plot.R
rbbt-util-5.32.17 share/Rlib/plot.R
rbbt-util-5.32.16 share/Rlib/plot.R
rbbt-util-5.32.15 share/Rlib/plot.R