boB Rudis
8 years ago
6 changed files with 1743 additions and 0 deletions
File diff suppressed because it is too large
@ -0,0 +1,61 @@ |
|||||
|
#' Pokemon color scales |
||||
|
#' |
||||
|
#' Color scales using the colors in the Pokemon characters |
||||
|
#' |
||||
|
#' Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
#' |
||||
|
#' @inheritParams ggplot2::scale_colour_hue |
||||
|
#' @inheritParams pokemon_pal |
||||
|
#' @family colour pokemon |
||||
|
#' @rdname scale_pokemon |
||||
|
#' @seealso \code{\link{theme_economist}} for examples. |
||||
|
#' @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 |
||||
|
#' |
||||
|
#' Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
#' |
||||
|
#' @param avatar avatar name. Use \code{list_avatars()} to see them all! |
||||
|
#' @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 |
||||
|
#' |
||||
|
#' Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
#' |
||||
|
#' @note Warning: huge! list |
||||
|
#' @export |
||||
|
list_avatars <- function() { |
||||
|
sort(names(pokemon)) |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
% 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{ |
||||
|
Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
} |
||||
|
\note{ |
||||
|
Warning: huge! list |
||||
|
} |
||||
|
|
@ -0,0 +1,15 @@ |
|||||
|
% 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{ |
||||
|
Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
} |
||||
|
|
@ -0,0 +1,30 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/pokemon.r |
||||
|
\name{scale_colour_pokemon} |
||||
|
\alias{scale_color_pokemon} |
||||
|
\alias{scale_colour_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 |
||||
|
} |
||||
|
\details{ |
||||
|
Data taken from the hard work by the \href{http://www.pokegraphs.com/}{folks here}. |
||||
|
} |
||||
|
\seealso{ |
||||
|
\code{\link{theme_economist}} for examples. |
||||
|
} |
||||
|
|
Loading…
Reference in new issue