Browse Source

CRAN Checks pass

tags/v0.4.0
boB Rudis 5 years ago
parent
commit
90d3e3ee40
  1. 12
      .Rd2pdf5285/Rd2.tex
  2. 20
      DESCRIPTION
  3. 7
      NAMESPACE
  4. 5
      NEWS
  5. 1617
      R/a-pokemon-colors.r
  6. 5
      R/annotate_textp.r
  7. 7
      R/geom2plotly.r
  8. 2
      R/geom_lollipop.r
  9. 3
      R/geom_twoway_bar.r
  10. 2
      R/ggalt-package.r
  11. 62
      R/pokemon.r
  12. 4
      R/stat-stepribbon.r
  13. BIN
      Rplot.png
  14. 2
      man/annotate_textp.Rd
  15. 14
      man/geom_lollipop.Rd
  16. 55
      man/geom_twoway_bar.Rd
  17. 23
      man/list_avatars.Rd
  18. 22
      man/plotly_helpers.Rd
  19. 24
      man/pokemon_pal.Rd
  20. 33
      man/scale_pokemon.Rd
  21. 4
      man/stat_stepribbon.Rd

12
.Rd2pdf5285/Rd2.tex

@ -1,12 +0,0 @@
\documentclass[a4paper]{book}
\usepackage[times,inconsolata,hyper]{Rd}
\usepackage{makeidx}
\usepackage[latin1]{inputenc} % @SET ENCODING@
% \usepackage{graphicx} % @USE GRAPHICX@
\makeindex{}
\begin{document}
\chapter*{}
\begin{center}
{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{ggalt}}}
\par\bigskip{\large \today}
\end{center}

20
DESCRIPTION

@ -1,10 +1,10 @@
Package: ggalt
Title: Extra Coordinate Systems, 'Geoms', Statistical Transformations, Scales
and Fonts for 'ggplot2'
Version: 0.4
Version: 0.4.0
Maintainer: Bob Rudis <bob@rudis.net>
Authors@R: c(
person("Bob", "Rudis", email = "bob@rudis.net", role = c("aut", "cre")),
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")),
person("Ben", "Bolder", role = c("aut", "ctb")),
person("Jan", "Schulz", role = c("aut", "ctb")),
person("Rosen", "Matev", role="ctb", comment="Original annotate_textp implementation on stackoverflow"),
@ -13,8 +13,13 @@ Authors@R: c(
)
Description: A compendium of 'geoms', 'coords', 'stats', scales and fonts for
'ggplot2', including splines, 1d and 2d densities, univariate average shifted
histograms, a new map coordinate system based on the 'PROJ.4'-library and the
'StateFace' open source font 'ProPublica'.
histograms, a new map coordinate system based on the 'PROJ.4'-library along
with a cartogram 'geom' that mimics the original functionality of
'geom_map', formatters for "bytes", a two-way bar 'geom' along with a
'stepribbon' 'geom', increased 'plotly' compatibility and the 'StateFace'
open source font 'ProPublica'. Further new functionality includes lollipop charts,
dumbbell charts, the ability to "encircle" points and coordinate-system-based
text annotations.
License: AGPL + file LICENSE
LazyData: true
URL: https://github.com/hrbrmstr/ggalt
@ -28,8 +33,10 @@ Suggests:
gridExtra,
knitr,
rmarkdown,
ggthemes
ggthemes,
reshape2
Imports:
utils,
graphics,
grDevices,
dplyr,
@ -43,11 +50,11 @@ Imports:
maps,
MASS,
extrafont,
tibble,
plotly (>= 3.4.1)
RoxygenNote: 6.0.0
VignetteBuilder: knitr
Collate:
'a-pokemon-colors.r'
'annotate_textp.r'
'coord_proj.r'
'formatters.r'
@ -68,7 +75,6 @@ Collate:
'ggalt-package.r'
'grob_absolute.r'
'guide_axis.r'
'pokemon.r'
'stateface.r'
'utils.r'
'zzz.r'

7
NAMESPACE

@ -38,12 +38,7 @@ export(geom_lollipop)
export(geom_stateface)
export(geom_twoway_bar)
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)
@ -61,6 +56,7 @@ import(grDevices)
import(graphics)
import(maps)
import(proj4)
import(utils)
importFrom(RColorBrewer,brewer.pal)
importFrom(dplyr,filter)
importFrom(extrafont,fonts)
@ -88,3 +84,4 @@ importFrom(gtable,gtable_row)
importFrom(gtable,gtable_width)
importFrom(scales,expand_range)
importFrom(scales,rescale)
importFrom(tibble,as_tibble)

5
NEWS

@ -1,3 +1,8 @@
0.4.0
=====================
* Fixed `coord_proj()`
* Removed pokemon colors (et al)
0.3.0
=====================
* Added `geom_lollipop()` to make it easer to create lollipop charts

1617
R/a-pokemon-colors.r

File diff suppressed because it is too large

5
R/annotate_textp.r

@ -1,3 +1,5 @@
globalVariables(c("Stepribbon"))
#' Text annotations in plot coordinate system
#'
#' Annotates the plot with text. Compared to \code{annotate("text",...)}, the
@ -16,6 +18,7 @@
#' aware that parts of the box which are outside of the visible region of the
#' plot will not be shown.
#' @param margin margins of the bounding box
#' @param alpha,family,size,fontface,lineheight standard aesthetic customizations
#' @examples
#' p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
#' p <- p + geom_smooth(method = "lm", se = FALSE)
@ -58,4 +61,4 @@ annotate_textp <- function(label, x, y, facets=NULL, hjust=0, vjust=0, color='bl
ymax=Inf
)
)
}
}

7
R/geom2plotly.r

@ -1,11 +1,18 @@
#' @name plotly_helpers
#' @title Plotly helpers
#' @description Helper functions to make it easier to automatically create plotly charts
#' @export
to_basic.GeomXspline <- to_basic.GeomXspline2 <-
getFromNamespace("to_basic.GeomLine", asNamespace("plotly"))
#' @rdname plotly_helpers
#' @export
to_basic.GeomBkde2d <-
getFromNamespace("to_basic.GeomDensity2d", asNamespace("plotly"))
#' @rdname plotly_helpers
#' @param data,prestats_data,layout,params,p,... plotly interface parameters
#' @keywords internal
#' @export
to_basic.GeomStateface <- function(data, prestats_data, layout, params, p, ...) {
prefix_class(data, "GeomText")

2
R/geom_lollipop.r

@ -30,7 +30,7 @@
#' 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.
#' @param If \code{horizontal} is \code{FALSE} (the default), the function
#' @param horizontal \code{horizontal} is \code{FALSE} (the default), the function
#' will draw the lollipops up from the X axis (i.e. it will set \code{xend}
#' to \code{x} & \code{yend} to \code{0}). If \code{TRUE}, it wiill set
#' \code{yend} to \code{y} & \code{xend} to \code{0}). Make sure you map the

3
R/geom_twoway_bar.r

@ -1,3 +1,6 @@
#' Two-way bar chart
#'
#' @inheritParams ggplot2::geom_bar
#' @export
geom_twoway_bar <- function(mapping = NULL, data = NULL,
stat = "identity",

2
R/ggalt-package.r

@ -15,4 +15,6 @@
#' @importFrom gtable gtable_col gtable_height gtable_width gtable_row gtable_col
#' @importFrom RColorBrewer brewer.pal
#' @importFrom extrafont loadfonts fonts ttf_import
#' @import utils
#' @importFrom tibble as_tibble
NULL

62
R/pokemon.r

@ -1,62 +0,0 @@
#' Pokemon color scales
#'
#' Color scales using the colors in the Pokemon characters
#'
#' @references \href{http://www.pokegraphs.com/}{Original JSON color list}.
#' @note Pokémon & Pokémon character names are trademarks of Nintendo.
#' @inheritParams ggplot2::scale_colour_hue
#' @inheritParams pokemon_pal
#' @family pokemon aeshetics
#' @rdname scale_pokemon
#' @export
scale_colour_pokemon <- function(avatar="bulbasaur", ...) {
discrete_scale("colour", "pokemon", pokemon_pal(avatar=avatar), ...)
}
#' @rdname scale_pokemon
#' @export
scale_color_pokemon <- scale_colour_pokemon
#' @rdname scale_pokemon
#' @export
scale_fill_pokemon <- function(avatar=FALSE, ...) {
discrete_scale("fill", "pokemon", pokemon_pal(avatar=avatar), ...)
}
#' Pick a Pokemon palette
#'
#' @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") {
avatar <- tolower(avatar)
if (!(avatar %in% names(pokemon))) {
message("avatar not found, using 'bulbasaur'")
avatar <- "bulbasaur"
}
best_colors <- function(avatar, n=1) {
unname(pokemon[[avatar]])
}
function(n) {
best_colors(avatar, n)
}
}
#' List Pokemon avatar names
#'
#' @references \href{http://www.pokegraphs.com/}{Original JSON color list}.
#' @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))
}

4
R/stat-stepribbon.r

@ -2,8 +2,10 @@
#'
#' Provides stairstep values for ribbon plots
#'
#' @md
#' @inheritParams ggplot2::geom_ribbon
#' @param direction \code{hv} for horizontal-veritcal steps, \code{vh} for
#' @param geom which geom to use; defaults to "`ribbon`"
#' @param direction \code{hv} for horizontal-veritcal steps, `vh`` for
#' vertical-horizontal steps
#' @references \url{https://groups.google.com/forum/?fromgroups=#!topic/ggplot2/9cFWHaH1CPs}
#' @export

BIN
Rplot.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

2
man/annotate_textp.Rd

@ -22,6 +22,8 @@ to the bounding box}
\item{color, }{alpha, family, size, fontface, lineheight font properties}
\item{alpha, family, size, fontface, lineheight}{standard aesthetic customizations}
\item{box_just}{placement of the bounding box for the text relative to x,y
coordinates. Per default, the box is placed to the center of the plot. Be
aware that parts of the box which are outside of the visible region of the

14
man/geom_lollipop.Rd

@ -33,6 +33,13 @@ 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.}
\item{horizontal}{\code{horizontal} is \code{FALSE} (the default), the function
will draw the lollipops up from the X axis (i.e. it will set \code{xend}
to \code{x} & \code{yend} to \code{0}). If \code{TRUE}, it wiill set
\code{yend} to \code{y} & \code{xend} to \code{0}). Make sure you map the
\code{x} & \code{y} aesthetics accordingly. This parameter helps avoid
the need for \code{coord_flip()}.}
\item{point.colour}{the colour of the point}
\item{point.size}{the size of the point}
@ -48,13 +55,6 @@ a warning. If \code{TRUE} silently removes missing values.}
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{If}{\code{horizontal} is \code{FALSE} (the default), the function
will draw the lollipops up from the X axis (i.e. it will set \code{xend}
to \code{x} & \code{yend} to \code{0}). If \code{TRUE}, it wiill set
\code{yend} to \code{y} & \code{xend} to \code{0}). Make sure you map the
\code{x} & \code{y} aesthetics accordingly. This parameter helps avoid
the need for \code{coord_flip()}.}
}
\description{
The lollipop geom is used to create lollipop charts.

55
man/geom_twoway_bar.Rd

@ -0,0 +1,55 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_twoway_bar.r
\name{geom_twoway_bar}
\alias{geom_twoway_bar}
\title{Two-way bar chart}
\usage{
geom_twoway_bar(mapping = NULL, data = NULL, stat = "identity",
width = NULL, ..., na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE)
}
\arguments{
\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}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link{ggplot}}.
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.
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{stat}{Override the default connection between \code{geom_bar} and
\code{stat_count}.}
\item{width}{Bar width. By default, set to 90\% of the resolution of the data.}
\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.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\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}}.}
}
\description{
Two-way bar chart
}

23
man/list_avatars.Rd

@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pokemon.r
\name{list_avatars}
\alias{list_avatars}
\title{List Pokemon avatar names}
\usage{
list_avatars()
}
\description{
List Pokemon avatar names
}
\note{
Warning: huge! list\cr
\cr
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{pokemon_pal}},
\code{\link{scale_colour_pokemon}}
}

22
man/plotly_helpers.Rd

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom2plotly.r
\name{plotly_helpers}
\alias{plotly_helpers}
\alias{to_basic.GeomXspline}
\alias{to_basic.GeomBkde2d}
\alias{to_basic.GeomStateface}
\title{Plotly helpers}
\usage{
to_basic.GeomXspline(data, prestats_data, layout, params, p, ...)
to_basic.GeomBkde2d(data, prestats_data, layout, params, p, ...)
to_basic.GeomStateface(data, prestats_data, layout, params, p, ...)
}
\arguments{
\item{data, prestats_data, layout, params, p, ...}{plotly interface parameters}
}
\description{
Helper functions to make it easier to automatically create plotly charts
}
\keyword{internal}

24
man/pokemon_pal.Rd

@ -1,24 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pokemon.r
\name{pokemon_pal}
\alias{pokemon_pal}
\title{Pick a Pokemon palette}
\usage{
pokemon_pal(avatar = "bulbasaur")
}
\arguments{
\item{avatar}{avatar name. Use \code{list_avatars()} to see them all!}
}
\description{
Pick a Pokemon palette
}
\note{
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}}
}

33
man/scale_pokemon.Rd

@ -1,33 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pokemon.r
\name{scale_colour_pokemon}
\alias{scale_colour_pokemon}
\alias{scale_color_pokemon}
\alias{scale_fill_pokemon}
\title{Pokemon color scales}
\usage{
scale_colour_pokemon(avatar = "bulbasaur", ...)
scale_color_pokemon(avatar = "bulbasaur", ...)
scale_fill_pokemon(avatar = FALSE, ...)
}
\arguments{
\item{avatar}{avatar name. Use \code{list_avatars()} to see them all!}
\item{...}{Other arguments passed on to \code{\link{discrete_scale}}
to control name, limits, breaks, labels and so forth.}
}
\description{
Color scales using the colors in the Pokemon characters
}
\note{
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/stat_stepribbon.Rd

@ -28,6 +28,8 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
the plot data. The return value must be a \code{data.frame.}, and
will be used as the layer data.}
\item{geom}{which geom to use; defaults to "\code{ribbon}"}
\item{position}{Position adjustment, either as a string, or the result of
a call to a position adjustment function.}
@ -43,7 +45,7 @@ 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{direction}{\code{hv} for horizontal-veritcal steps, \code{vh} for
\item{direction}{\code{hv} for horizontal-veritcal steps, `vh`` for
vertical-horizontal steps}
\item{...}{other arguments passed on to \code{\link{layer}}. These are

Loading…
Cancel
Save