Browse Source

geom_table

pull/6/head
Bob Rudis 6 years ago
parent
commit
34aa376d88
  1. 3
      DESCRIPTION
  2. 73
      NAMESPACE
  3. 1
      NEWS
  4. 94
      R/geom_encircle.r
  5. 94
      R/geom_table.r
  6. 1
      R/geom_xspline.r
  7. 26
      R/geom_xspline2.r
  8. 4
      R/pokemon.r
  9. 12
      R/stateface.r
  10. 48
      README.Rmd
  11. 37
      README.html
  12. 63
      README.md
  13. BIN
      README_figs/README-encircle-1.png
  14. BIN
      README_figs/README-encircle-2.png
  15. BIN
      README_figs/README-encircle-3.png
  16. BIN
      README_figs/README-encircle-4.png
  17. BIN
      README_figs/README-encircle-5.png
  18. BIN
      README_figs/README-encircle-6.png
  19. BIN
      README_figs/README-encircle-7.png
  20. 45
      man/geom_encircle.Rd
  21. 4
      man/geom_stateface.Rd
  22. 17
      man/geom_table.Rd
  23. 2
      man/geom_xspline.Rd
  24. 51
      man/geom_xspline2.Rd
  25. 5
      man/ggalt-ggproto.Rd
  26. 4
      man/list_avatars.Rd
  27. 7
      man/load_stateface.Rd
  28. 4
      man/pokemon_pal.Rd
  29. 4
      man/scale_pokemon.Rd
  30. 4
      man/show_stateface.Rd

3
DESCRIPTION

@ -2,8 +2,11 @@ Package: ggalt
Title: Extra Coordinate Systems, 'Geoms', Statistical Transformations, Scales and
Fonts for 'ggplot2'
Version: 0.2.0.9000
Maintainer: Bob Rudis <bob@rudis.net>
Authors@R: c(
person("Bob", "Rudis", email = "bob@rudis.net", role = c("aut", "cre")),
person("Ben", "Bolder", role = c("aut", "ctb")),
person("Jan", "Schulz", role = c("aut", "ctb")),
person("Ingemar", role="dtc", comment="Pokémon javascript color palette"),
person("ProPublica", role="dtc", comment="StateFace font")
)

73
NAMESPACE

@ -0,0 +1,73 @@
# Generated by roxygen2: do not edit by hand
S3method(grid.draw,absoluteGrob)
S3method(grobHeight,absoluteGrob)
S3method(grobWidth,absoluteGrob)
S3method(grobX,absoluteGrob)
S3method(grobY,absoluteGrob)
export(CoordProj)
export(Gb)
export(GeomBkde)
export(GeomBkde2d)
export(GeomEncircle)
export(GeomStateface)
export(GeomTable)
export(GeomXSpline2)
export(GeomXspline)
export(Kb)
export(Mb)
export(StatAsh)
export(StatBkde)
export(StatBkde2d)
export(StatXspline)
export(byte_format)
export(bytes)
export(coord_proj)
export(geom_bkde)
export(geom_bkde2d)
export(geom_encircle)
export(geom_stateface)
export(geom_xspline)
export(list_avatars)
export(load_stateface)
export(pokemon_pal)
export(scale_color_pokemon)
export(scale_colour_pokemon)
export(scale_fill_pokemon)
export(show_stateface)
export(stat_ash)
export(stat_bkde)
export(stat_bkde2d)
export(stat_xspline)
import(KernSmooth)
import(MASS)
import(ash)
import(ggplot2)
import(grDevices)
import(graphics)
import(maps)
import(proj4)
importFrom(RColorBrewer,brewer.pal)
importFrom(dplyr,filter)
importFrom(extrafont,fonts)
importFrom(extrafont,loadfonts)
importFrom(extrafont,ttf_import)
importFrom(grid,gList)
importFrom(grid,gTree)
importFrom(grid,gpar)
importFrom(grid,grid.draw)
importFrom(grid,grobHeight)
importFrom(grid,grobName)
importFrom(grid,grobTree)
importFrom(grid,grobWidth)
importFrom(grid,grobX)
importFrom(grid,grobY)
importFrom(grid,textGrob)
importFrom(grid,unit.c)
importFrom(grid,viewport)
importFrom(gtable,gtable_col)
importFrom(gtable,gtable_height)
importFrom(gtable,gtable_row)
importFrom(gtable,gtable_width)
importFrom(scales,expand_range)
importFrom(scales,rescale)

1
NEWS

@ -1,6 +1,7 @@
0.2.0
=====================
* Incorporated ProPublica StateFace font
* `geom_encircle()` contributed by Ben Bolker
0.1.5
=====================

94
R/geom_encircle.r

@ -1,3 +1,7 @@
#' @rdname ggalt-ggproto
#' @format NULL
#' @usage NULL
#' @export
GeomEncircle <- ggproto("GeomEncircle", Geom,
required_aes = c("x", "y"),
default_aes = aes(colour = "black",
@ -23,14 +27,14 @@ GeomEncircle <- ggproto("GeomEncircle", Geom,
coords <- coords[ch,]
## FIXME: using grid:: a lot. importFrom instead?
## convert from lengths to physical units, for computing *directions*
cc <- function(x,dir="x")
grid::convertUnit(grid::unit(x,"native"),"mm",typeFrom="dimension",
axisFrom=dir,valueOnly=TRUE)
## convert back to native (e.g. native + snpc offset)
cc_inv <- function(x,dir="x")
cc_inv <- function(x,dir="x")
grid::convertUnit(x,"native",typeFrom="location",
axisFrom=dir,valueOnly=TRUE)
@ -102,7 +106,7 @@ if (FALSE) {
cc <- function(x,dir="x")
grid::convertUnit(grid::unit(x,"native"),"mm",typeFrom="dimension",
axisFrom=dir,valueOnly=TRUE)
cc_inv <- function(x,dir="x")
cc_inv <- function(x,dir="x")
grid::convertUnit(x,"native",typeFrom="location",
axisFrom=dir,valueOnly=TRUE)
@ -116,7 +120,7 @@ if (FALSE) {
r <- sqrt(dx*dx+dy*dy)
list(x=dx/r,y=dy/r)
}
dd <- c(rot %*% unlist(normFun(coords[1,],coords[2,])))*
coords$spread
z <- with(coords, {
@ -136,46 +140,54 @@ if (FALSE) {
print(grid::convertWidth(unit(1,'npc'),'native'))
print(grid::convertHeight(unit(1,'npc'),'native'))
}
##' encircle
##'
##' @title encircle
##' @param mapping mapping
##' @param data data
##' @param stat stat
##' @param position position
##' @param na.rm na.rm
##' @param show.legend show.legend
##' @param inherit.aes inherit.aes
##' @param ... dots
##' @return adds a circle around the specified points
##' @author Ben Bolker
##' @export
##' @examples
##' d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
##' (g0 <- ggplot(d,aes(x,y))+geom_point()+
##' geom_encircle(s_shape=1,expand=0)+
##' geom_encircle(s_shape=1,expand=0.1,colour="red")+
##' scale_x_continuous(expand=c(0.5,1))+
##' scale_y_continuous(expand=c(0.5,1))+
##' geom_encircle(s_shape=0.5,expand=0.1,colour="purple"))
##' g0 + geom_encircle(data=subset(d,x==1),colour="blue",spread=0.02)+
##' geom_encircle(data=subset(d,x==2),colour="cyan",spread=0.04)
##'
##' g0 <- ggplot(mpg, aes(displ, hwy)) + geom_point()
##' (g1 <- g0 + geom_encircle(data=subset(mpg,hwy>40)))
##' ss <- subset(mpg,hwy>31 & displ<2)
##' g1 + geom_point(data=ss,colour="blue")+
##' geom_encircle(data=ss,colour="blue",s_shape=0.9,
##' expand=0.07)
}
#' Automatically enclose points in a polygon
#'
#' @param mapping mapping
#' @param data data
#' @param stat stat
#' @param position position
#' @param na.rm na.rm
#' @param show.legend show.legend
#' @param inherit.aes inherit.aes
#' @param ... dots
#' @return adds a circle around the specified points
#' @author Ben Bolker
#' @export
#' @examples
#' d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
#'
#' gg <- ggplot(d,aes(x,y))
#' gg <- gg + scale_x_continuous(expand=c(0.5,1))
#' gg <- gg + scale_y_continuous(expand=c(0.5,1))
#'
#' gg + geom_encircle(s_shape=1, expand=0) + geom_point()
#'
#' gg + geom_encircle(s_shape=1, expand=0.1, colour="red") + geom_point()
#'
#' gg + geom_encircle(s_shape=0.5, expand=0.1, colour="purple") + geom_point()
#'
#' gg + geom_encircle(data=subset(d, x==1), colour="blue", spread=0.02) +
#' geom_point()
#'
#' gg +geom_encircle(data=subset(d, x==2), colour="cyan", spread=0.04) +
#' geom_point()
#'
#' gg <- ggplot(mpg, aes(displ, hwy))
#' gg + geom_encircle(data=subset(mpg, hwy>40)) + geom_point()
#'
#' ss <- subset(mpg,hwy>31 & displ<2)
#'
#' gg + geom_encircle(data=ss, colour="blue", s_shape=0.9, expand=0.07) +
#' geom_point() + geom_point(data=ss, colour="blue")
geom_encircle <- function(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...) {
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...) {
layer(
geom = GeomEncircle, mapping = mapping, data = data, stat = stat,
geom = GeomEncircle, mapping = mapping, data = data, stat = stat,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
params = list(na.rm = na.rm, ...)
)

94
R/geom_table.r

@ -0,0 +1,94 @@
#' @rdname ggalt-ggproto
#' @format NULL
#' @usage NULL
#' @export
GeomTable <- ggproto(
"GeomTable",
Geom,
required_aes = c("x", "y", "table"),
default_aes = aes(
widthx = 10,
widthy = 10,
rownames = NA
),
draw_key = draw_key_blank,
draw_panel = function(data, panel_scales, coord) {
if (nrow(data) != 1) {
stop(
sprintf(
"only one table per panel allowed, got %s (%s)",
nrow(data),
as.character(data)
),
call. = FALSE
)
}
wy = data$widthy / 2
wx = data$widthx / 2
corners <-
data.frame(x = c(data$x - wx, data$x + wx),
y = c(data$y - wy, data$y + wy))
d <- coord$transform(corners, panel_scales)
# gross hack, but I've found no other way to get a table/matrix/dataframe to this point :-(
table = read.csv(text = data$table, header = TRUE)
if (!is.na(data$rownames)) {
rownames(table) <-
unlist(strsplit(data$rownames, "|", fixed = TRUE))
}
x_rng <- range(d$x, na.rm = TRUE)
y_rng <- range(d$y, na.rm = TRUE)
vp <-
viewport(
x = mean(x_rng),
y = mean(y_rng),
width = diff(x_rng),
height = diff(y_rng),
just = c("center", "center")
)
grob <-
tableGrob(table, theme = ttheme_minimal())
# add a line across the header
grob <- gtable_add_grob(
grob,
grobs = segmentsGrob(y1 = unit(0, "npc"),
gp = gpar(lwd = 2.0)),
t = 1,
b = 1,
l = 1,
r = ncol(d) + 1
)
editGrob(grob, vp = vp, name = paste(grob$name, facet_id()))
}
)
facet_id <- local({
i <- 1
function() {
i <<- i + 1
i
}
})
#' Add a table to a ggplot2 plot
#'
#' @author Jan Schulz
geom_table <- function(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...) {
layer(
geom = GeomTable,
mapping = mapping,
data = data,
stat = stat,
position = position,
show.legend = show.legend,
inherit.aes = inherit.aes,
params = list(na.rm = na.rm, ...)
)
}

1
R/geom_xspline.r

@ -73,6 +73,7 @@
#' Designed for the End User", in \emph{Proceedings of SIGGRAPH 95},
#' pp. 377-386. \url{http://dept-info.labri.fr/~schlick/DOC/sig1.html}
#' @export
#' @family xspline implementations
#' @examples
#' set.seed(1492)
#' dat <- data.frame(x=c(1:10, 1:10, 1:10),

26
R/geom_xspline2.r

@ -1,3 +1,7 @@
#' @rdname ggalt-ggproto
#' @format NULL
#' @usage NULL
#' @export
GeomXSpline2 <- ggproto("GeomXSpline", Geom,
required_aes = c("x", "y"),
default_aes = aes(colour = "black", s_shape=1, s_open=FALSE),
@ -14,24 +18,18 @@ GeomXSpline2 <- ggproto("GeomXSpline", Geom,
}
)
##' Xspline
##'
##' @title xsplines
##' @param mapping mapping
##' @param data data
##' @param stat stat
##' @param position position
##' @param na.rm na.rm
##' @param show.legend show.legend
##' @param inherit.aes inherit.aes
##' @param ... stuff
##' @return creates a spline curve
##' @author Ben Bolker
#' Alternative implemenation for connecting control points/observations
#' with an X-spline
#'
#' @inheritParams geom_xspline
#' @return creates a spline curve
#' @author Ben Bolker
#' @family xspline implementations
geom_xspline2 <- function(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...) {
layer(
geom = GeomXSpline2, mapping = mapping, data = data, stat = stat,
geom = GeomXSpline2, mapping = mapping, data = data, stat = stat,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
params = list(na.rm = na.rm, ...)
)

4
R/pokemon.r

@ -6,7 +6,7 @@
#' @note Pokémon & Pokémon character names are trademarks of Nintendo.
#' @inheritParams ggplot2::scale_colour_hue
#' @inheritParams pokemon_pal
#' @family colour pokemon
#' @family pokemon aeshetics
#' @rdname scale_pokemon
#' @export
scale_colour_pokemon <- function(avatar="bulbasaur", ...) {
@ -28,6 +28,7 @@ scale_fill_pokemon <- function(avatar=FALSE, ...) {
#' @references \href{http://www.pokegraphs.com/}{Original JSON color list}.
#' @note Pokémon & Pokémon character names are trademarks of Nintendo.
#' @param avatar avatar name. Use \code{list_avatars()} to see them all!
#' @family pokemon aeshetics
#' @export
pokemon_pal <- function(avatar="bulbasaur") {
@ -54,6 +55,7 @@ pokemon_pal <- function(avatar="bulbasaur") {
#' @note Warning: huge! list\cr
#' \cr
#' Pokémon & Pokémon character names are trademarks of Nintendo.
#' @family pokemon aeshetics
#' @export
list_avatars <- function() {
sort(names(pokemon))

12
R/stateface.r

@ -14,13 +14,16 @@ state_tbl <- setNames(toupper(state.abb), tolower(state.name))
#' Displays the path to the StateFace font. For the font to work
#' in the on-screen plot device for ggplot2, you need to install
#' the font on your system
#'
#' @family StateFace operations
#' @export
show_stateface <- function() {
path = normalizePath(file.path(system.file("fonts/", package="ggalt")))
path <- normalizePath(file.path(system.file("fonts/", package="ggalt")))
print(path)
if (!interactive) return()
if (.Platform$OS.type == "windows") {
shell(sprintf("explorer %s", path), intern=TRUE)
} else if(.Platform$OS.type == "unix") {
@ -33,6 +36,10 @@ show_stateface <- function() {
#' Load stateface font
#'
#' Makes the ProPublica StateFace font available to PDF, PostScript,
#' et. al. devices.
#'
#' @family StateFace operations
#' @export
load_stateface <- function() {
if (interactive()) message("Loading stateface device fonts...")
@ -62,6 +69,7 @@ load_stateface <- function() {
#' abels by. Useful for offsetting text from points, particularly
#' on discrete scales.
#' @inheritParams ggplot2::geom_text
#' @family StateFace operations
#' @export
#' @examples
#' library(ggplot2)

48
README.Rmd

@ -33,27 +33,15 @@ The following functions are implemented:
- `geom_xspline` : Connect control points/observations with an X-spline
- `stat_xspline` : Connect control points/observations with an X-spline
- `geom_bkde` : Display a smooth density estimate (uses `KernSmooth::bkde`)
- `stat_bkde` : Display a smooth density estimate (uses `KernSmooth::bkde`)
-- `geom_stateface`: Use ProPublica's StateFace font in ggplot2 plots- `stat_bkde` : Display a smooth density estimate (uses `KernSmooth::bkde`)
- `geom_bkde2d` : Contours from a 2d density estimate. (uses `KernSmooth::bkde2D`)
- `stat_bkde2d` : Contours from a 2d density estimate. (uses `KernSmooth::bkde2D`)
- `stat_ash` : Compute and display a univariate averaged shifted histogram (polynomial kernel) (uses `ash::ash1`/`ash::bin1`)
- `scale_color_pokemon` :
-- `geom_encircle`: Automatically enclose points in a polygon
`scale_color_pokemon` :
- `scale_fill_pokemon` : discrete pokemon scales (data taken from the hard work by the <http://www.pokegraphs.com/>)
- `byte_format`: + helpers. e.g. turn `10000` into `10 Kb`
### News
- Version 0.1.5.9000 - Pokemon discrete color scales!
- Version 0.1.2.9000 - Fixed bug with limits not working in coord_proj thx to @mstrimas
- Version 0.1.1 - CRAN!
- Version 0.1.0.9000 - Tweaks for ggplot2 2.0 release
- Version 0.0.4.9000 - `stat_ash`
- Version 0.0.3.9000 - `coord_proj`! (requires my github copy of ggplot2 for now)
- Version 0.0.2.9005 - cleanup before blog post
- Version 0.0.2.9002 - working 2D density plots
- Version 0.0.2.9000 initial release
### Installation
```{r eval=FALSE}
@ -223,6 +211,36 @@ gg <- gg + scale_size_identity()
gg
```
### Encircling points automagically
```{r encircle}
d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
gg <- ggplot(d,aes(x,y))
gg <- gg + scale_x_continuous(expand=c(0.5,1))
gg <- gg + scale_y_continuous(expand=c(0.5,1))
gg + geom_encircle(s_shape=1, expand=0) + geom_point()
gg + geom_encircle(s_shape=1, expand=0.1, colour="red") + geom_point()
gg + geom_encircle(s_shape=0.5, expand=0.1, colour="purple") + geom_point()
gg + geom_encircle(data=subset(d, x==1), colour="blue", spread=0.02) +
geom_point()
gg +geom_encircle(data=subset(d, x==2), colour="cyan", spread=0.04) +
geom_point()
gg <- ggplot(mpg, aes(displ, hwy))
gg + geom_encircle(data=subset(mpg, hwy>40)) + geom_point()
ss <- subset(mpg,hwy>31 & displ<2)
gg + geom_encircle(data=ss, colour="blue", s_shape=0.9, expand=0.07) +
geom_point() + geom_point(data=ss, colour="blue")
```
### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).

37
README.html

File diff suppressed because one or more lines are too long

63
README.md

@ -313,6 +313,69 @@ gg
<img src="README_figs/README-stateface-1.png" title="" alt="" width="672" />
### Encircling points automagically
```r
d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
gg <- ggplot(d,aes(x,y))
gg <- gg + scale_x_continuous(expand=c(0.5,1))
gg <- gg + scale_y_continuous(expand=c(0.5,1))
gg + geom_encircle(s_shape=1, expand=0) + geom_point()
```
<img src="README_figs/README-encircle-1.png" title="" alt="" width="672" />
```r
gg + geom_encircle(s_shape=1, expand=0.1, colour="red") + geom_point()
```
<img src="README_figs/README-encircle-2.png" title="" alt="" width="672" />
```r
gg + geom_encircle(s_shape=0.5, expand=0.1, colour="purple") + geom_point()
```
<img src="README_figs/README-encircle-3.png" title="" alt="" width="672" />
```r
gg + geom_encircle(data=subset(d, x==1), colour="blue", spread=0.02) +
geom_point()
```
<img src="README_figs/README-encircle-4.png" title="" alt="" width="672" />
```r
gg +geom_encircle(data=subset(d, x==2), colour="cyan", spread=0.04) +
geom_point()
```
<img src="README_figs/README-encircle-5.png" title="" alt="" width="672" />
```r
gg <- ggplot(mpg, aes(displ, hwy))
gg + geom_encircle(data=subset(mpg, hwy>40)) + geom_point()
```
<img src="README_figs/README-encircle-6.png" title="" alt="" width="672" />
```r
ss <- subset(mpg,hwy>31 & displ<2)
gg + geom_encircle(data=ss, colour="blue", s_shape=0.9, expand=0.07) +
geom_point() + geom_point(data=ss, colour="blue")
```
<img src="README_figs/README-encircle-7.png" title="" alt="" width="672" />
### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).

BIN
README_figs/README-encircle-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
README_figs/README-encircle-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
README_figs/README-encircle-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
README_figs/README-encircle-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
README_figs/README-encircle-5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
README_figs/README-encircle-6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
README_figs/README-encircle-7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

45
man/geom_encircle.Rd

@ -2,7 +2,7 @@
% Please edit documentation in R/geom_encircle.r
\name{geom_encircle}
\alias{geom_encircle}
\title{encircle}
\title{Automatically enclose points in a polygon}
\usage{
geom_encircle(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
@ -29,25 +29,34 @@ geom_encircle(mapping = NULL, data = NULL, stat = "identity",
adds a circle around the specified points
}
\description{
encircle
Automatically enclose points in a polygon
}
\examples{
d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
(g0 <- ggplot(d,aes(x,y))+geom_point()+
geom_encircle(s_shape=1,expand=0)+
geom_encircle(s_shape=1,expand=0.1,colour="red")+
scale_x_continuous(expand=c(0.5,1))+
scale_y_continuous(expand=c(0.5,1))+
geom_encircle(s_shape=0.5,expand=0.1,colour="purple"))
g0 + geom_encircle(data=subset(d,x==1),colour="blue",spread=0.02)+
geom_encircle(data=subset(d,x==2),colour="cyan",spread=0.04)
g0 <- ggplot(mpg, aes(displ, hwy)) + geom_point()
(g1 <- g0 + geom_encircle(data=subset(mpg,hwy>40)))
ss <- subset(mpg,hwy>31 & displ<2)
g1 + geom_point(data=ss,colour="blue")+
geom_encircle(data=ss,colour="blue",s_shape=0.9,
expand=0.07)
d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
gg <- ggplot(d,aes(x,y))
gg <- gg + scale_x_continuous(expand=c(0.5,1))
gg <- gg + scale_y_continuous(expand=c(0.5,1))
gg + geom_encircle(s_shape=1, expand=0) + geom_point()
gg + geom_encircle(s_shape=1, expand=0.1, colour="red") + geom_point()
gg + geom_encircle(s_shape=0.5, expand=0.1, colour="purple") + geom_point()
gg + geom_encircle(data=subset(d, x==1), colour="blue", spread=0.02) +
geom_point()
gg +geom_encircle(data=subset(d, x==2), colour="cyan", spread=0.04) +
geom_point()
gg <- ggplot(mpg, aes(displ, hwy))
gg + geom_encircle(data=subset(mpg, hwy>40)) + geom_point()
ss <- subset(mpg,hwy>31 & displ<2)
gg + geom_encircle(data=ss, colour="blue", s_shape=0.9, expand=0.07) +
geom_point() + geom_point(data=ss, colour="blue")
}
\author{
Ben Bolker

4
man/geom_stateface.Rd

@ -96,4 +96,8 @@ gg <- gg + scale_color_identity()
gg <- gg + scale_size_identity()
gg
}
\seealso{
Other StateFace operations: \code{\link{load_stateface}},
\code{\link{show_stateface}}
}

17
man/geom_table.Rd

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_table.r
\name{geom_table}
\alias{geom_table}
\title{Add a table to a ggplot2 plot}
\usage{
geom_table(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
}
\description{
Add a table to a ggplot2 plot
}
\author{
Jan Schulz
}

2
man/geom_xspline.Rd

@ -189,5 +189,7 @@ Blanc, C. and Schlick, C. (1995), "X-splines : A Spline Model
\code{\link[ggplot2]{geom_segment}}: Line segments;
\code{\link[graphics]{xspline}};
\code{\link[grid]{grid.xspline}}
Other xspline implementations: \code{\link{geom_xspline2}}
}

51
man/geom_xspline2.Rd

@ -2,36 +2,67 @@
% Please edit documentation in R/geom_xspline2.r
\name{geom_xspline2}
\alias{geom_xspline2}
\title{xsplines}
\title{Alternative implemenation for connecting control points/observations
with an X-spline}
\usage{
geom_xspline2(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
}
\arguments{
\item{mapping}{mapping}
\item{mapping}{Set of aesthetic mappings created by \code{\link{aes}} or
\code{\link{aes_}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
\item{data}{data}
\item{data}{The data to be displayed in this layer. There are three
options:
\item{stat}{stat}
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link{ggplot}}.
\item{position}{position}
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link{fortify}} for which variables will be created.
\item{na.rm}{na.rm}
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame.}, and
will be used as the layer data.}
\item{show.legend}{show.legend}
\item{stat}{Use to override the default connection between
\code{geom_xspline} and \code{stat_xspline}.}
\item{inherit.aes}{inherit.aes}
\item{position}{Position adjustment, either as a string, or the result of
a call to a position adjustment function.}
\item{...}{stuff}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}
\item{inherit.aes}{If \code{FALSE}, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. \code{\link{borders}}.}
\item{...}{other arguments passed on to \code{\link{layer}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{color = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
}
\value{
creates a spline curve
}
\description{
Xspline
Alternative implemenation for connecting control points/observations
with an X-spline
}
\author{
Ben Bolker
}
\seealso{
Other xspline implementations: \code{\link{geom_xspline}}
}

5
man/ggalt-ggproto.Rd

@ -1,11 +1,14 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coord_proj.r, R/geom_ash.r, R/geom_bkde.r, R/geom_bkde2d.r, R/geom_xspline.r, R/stateface.r
% Please edit documentation in R/coord_proj.r, R/geom_ash.r, R/geom_bkde.r, R/geom_bkde2d.r, R/geom_encircle.r, R/geom_table.r, R/geom_xspline.r, R/geom_xspline2.r, R/stateface.r
\docType{data}
\name{CoordProj}
\alias{CoordProj}
\alias{GeomBkde}
\alias{GeomBkde2d}
\alias{GeomEncircle}
\alias{GeomStateface}
\alias{GeomTable}
\alias{GeomXSpline2}
\alias{GeomXspline}
\alias{StatAsh}
\alias{StatBkde}

4
man/list_avatars.Rd

@ -17,4 +17,8 @@ Warning: huge! list\cr
\references{
\href{http://www.pokegraphs.com/}{Original JSON color list}.
}
\seealso{
Other pokemon aeshetics: \code{\link{pokemon_pal}},
\code{\link{scale_colour_pokemon}}
}

7
man/load_stateface.Rd

@ -7,6 +7,11 @@
load_stateface()
}
\description{
Load stateface font
Makes the ProPublica StateFace font available to PDF, PostScript,
et. al. devices.
}
\seealso{
Other StateFace operations: \code{\link{geom_stateface}},
\code{\link{show_stateface}}
}

4
man/pokemon_pal.Rd

@ -18,4 +18,8 @@ Pokémon & Pokémon character names are trademarks of Nintendo.
\references{
\href{http://www.pokegraphs.com/}{Original JSON color list}.
}
\seealso{
Other pokemon aeshetics: \code{\link{list_avatars}},
\code{\link{scale_colour_pokemon}}
}

4
man/scale_pokemon.Rd

@ -27,4 +27,8 @@ Pokémon & Pokémon character names are trademarks of Nintendo.
\references{
\href{http://www.pokegraphs.com/}{Original JSON color list}.
}
\seealso{
Other pokemon aeshetics: \code{\link{list_avatars}},
\code{\link{pokemon_pal}}
}

4
man/show_stateface.Rd

@ -11,4 +11,8 @@ Displays the path to the StateFace font. For the font to work
in the on-screen plot device for ggplot2, you need to install
the font on your system
}
\seealso{
Other StateFace operations: \code{\link{geom_stateface}},
\code{\link{load_stateface}}
}

Loading…
Cancel
Save