Type: | Package |
Title: | Color Palettes Based on Fish Species |
Version: | 0.2.3 |
Maintainer: | Nina M. D. Schiettekatte <nina.schiettekatte@gmail.com> |
Description: | Implementation of color palettes based on fish species. |
License: | GPL-2 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Suggests: | testthat, knitr, rmarkdown, rfishbase, rnaturalearth, pkgdown |
URL: | https://github.com/nschiett/fishualize |
BugReports: | https://github.com/nschiett/fishualize/issues |
Imports: | ggplot2 (≥ 1.0.1), gridExtra, grid, png, downloader, utils, httr, magrittr, stringr, dplyr, tidyr, scales, rlang, curl |
RoxygenNote: | 7.1.2 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2022-03-08 01:56:28 UTC; nina |
Author: | Nina M. D. Schiettekatte [cre, aut], Simon J. Brandl [aut], Jordan M. Casey [aut] |
Repository: | CRAN |
Date/Publication: | 2022-03-08 13:30:02 UTC |
fish silhouette in ggplot2
Description
Adds a fish silhouette to your plot
Usage
add_fishape(
family = "Pomacanthidae",
option = "Centropyge_loricula",
xmin = -Inf,
xmax = Inf,
ymin = -Inf,
ymax = Inf,
scaled = FALSE,
xlim = NULL,
ylim = NULL,
fill = "#000000",
alpha = 1
)
Arguments
family |
character string indicating the fish family. |
option |
character string indicating the fish species. If NA, the first available option within a family will be selected |
xmin |
x location giving minimum horizontal location of silhouette |
xmax |
x location giving maximum horizontal location of silhouette |
ymin |
y location giving minimum vertical location of silhouette |
ymax |
y location giving maximum vertical location of silhouette |
scaled |
logical parameter. If TRUE, location parameters (xmin, xmax, ymin, ymax) should range between 0 and 1. If FALSE, location parameters should be provided according to the values on the plot axes. |
xlim , ylim |
vectors of length = 2, contains the data limits and must be provided if scaled is TRUE. |
fill |
color of fish shape |
alpha |
transparency of fish shape (value between 0 and 1) |
Value
Adds a fish silhouette grob to a ggplot object.
Examples
## Not run:
library(ggplot2)
ggplot() + add_fishape(fill = fish(n = 5)[4])
ggplot(diamonds)+
geom_bar(aes(cut, fill = cut)) +
scale_fill_fish_d(option = "Naso_lituratus") +
add_fishape(family = "Acanthuridae",
option = "Naso_unicornis",
xmin = 1, xmax = 3, ymin = 15000, ymax = 20000,
fill = fish(option = "Naso_lituratus", n = 5)[3],
alpha = 0.8) +
theme_bw()
## example with relative coordinates
ggplot(diamonds)+
geom_bar(aes(cut, fill = cut)) +
scale_fill_fish_d(option = "Naso_lituratus") +
add_fishape(family = "Acanthuridae",
option = "Naso_unicornis",
xmin = 0, xmax = 0.3, ymin = 0.8, ymax = 1,
scaled = TRUE,
xlim = c(0.5, 5.5), ylim = c(0, 21000) ,
fill = fish(option = "Naso_lituratus", n = 5)[3],
alpha = 1) +
theme_bw()
## End(Not run)
fish Colour Map.
Description
This function creates a vector of n
equally spaced colors along the
'fish colour map' of your selection
Usage
fish(
n,
alpha = 1,
begin = 0,
end = 1,
direction = 1,
option = "Centropyge_loricula"
)
fish_pal(
alpha = 1,
begin = 0,
end = 1,
direction = 1,
option = "Centropyge_loricula"
)
Arguments
n |
The number of colors ( |
alpha |
The alpha transparency, a number in [0,1], see argument alpha in
|
begin |
The (corrected) hue in [0,1] at which the fish colormap begins. |
end |
The (corrected) hue in [0,1] at which the fish colormap ends. |
direction |
Sets the order of colors in the scale. If 1, the default, colors are ordered from darkest to lightest. If -1, the order of colors is reversed. |
option |
A character string indicating the fish species to use. |
Value
fish
returns a character vector, cv
, of color hex
codes. This can be used either to create a user-defined color palette for
subsequent graphics by palette(cv)
, a col =
specification in
graphics functions or in par
.
Semi-transparent colors (0 < alpha < 1
) are supported only on some
devices: see rgb
.
Examples
library(ggplot2)
library(fishualize)
dat <- data.frame(x = rnorm(1e4), y = rnorm(1e4))
ggplot(dat, aes(x = x, y = y)) +
stat_density_2d(geom = "raster",
aes(fill = after_stat(density)), contour = FALSE) +
scale_fill_gradientn(colors = fish(128, option = 'Ostracion_cubicus'))
pal <- fish(256, option = "Thalassoma_hardwicke", direction = -1)
image(volcano, col = pal)
Available Palettes.
Description
This function returns a vector containing the names of all the available palettes in the 'fishualize' package.
Usage
fish_palettes()
Value
fish_palettes
returns a character vector with the names of the fish palettes available to use.
Examples
fish_palettes()
Available fish silhouettes
Description
This function returns a dataframe containing the all the available fish silhouettes accessible through the 'fishualize' package.
Usage
fishapes()
Value
fishapes
returns a dataframe containing the all the available fish
silhouettes available to use.
Examples
fishapes()
Original fish color database
Description
A dataset containing some colour palettes inspired by fish species
Usage
fishcolors
Format
A data frame containing all the colours used in the palette:
option: It is intended to be a general option for choosing the specific colour palette.
hex: hex color code
Visualization of fish color palette
Description
This function creates an image of the specified fish color palette.
Usage
fishualize(option = "Centropyge_loricula", n = 5, ...)
Arguments
option |
A character string indicating the fish species to use. |
n |
The number of colors ( |
... |
Other arguments as can be specified in the function |
Value
fishualize
returns a visualisation of the specified color palette.
Examples
fishualize::fishualize()
fishualize::fishualize(option = "Zanclus_cornutus", n = 8)
fish colour scales
Description
Uses the fish color scale.
Usage
scale_color_fish(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1,
discrete = FALSE
)
scale_colour_fish(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1,
discrete = FALSE
)
scale_colour_fish_d(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1
)
scale_color_fish_d(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1
)
scale_fill_fish_d(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1
)
scale_fill_fish(
option = "Centropyge_loricula",
...,
alpha = 1,
begin = 0,
end = 1,
direction = 1,
discrete = FALSE
)
Arguments
option |
A character string indicating the fish species to use. |
... |
parameters to |
alpha |
pass through parameter to |
begin |
The (corrected) hue in [0,1] at which the fish colormap begins. |
end |
The (corrected) hue in [0,1] at which the fish colormap ends. |
direction |
Sets the order of colors in the scale. If 1, the default, colors
are as output by |
discrete |
generate a discrete palette? (default: |
Details
For discrete == FALSE
(the default) all other arguments are as to
scale_fill_gradientn or scale_color_gradientn.
Otherwise the function will return a discrete_scale
with the plot-computed
number of colors.
Value
Alias of scale_color_fish or scale_fill_fish
Alias of scale_color_fish or scale_fill_fish
Alias of scale_color_fish or scale_fill_fish
Alias of scale_color_fish or scale_fill_fish
Alias of scale_color_fish or scale_fill_fish
Examples
library(ggplot2)
library(fishualize)
ggplot(diamonds, aes(factor(cut), fill=factor(cut))) +
geom_bar() +
scale_fill_fish(discrete = TRUE, option = "Centropyge_loricula")
ggplot(mtcars, aes(factor(gear), fill=factor(carb))) +
geom_bar() +
scale_fill_fish(discrete = TRUE, option = "Trimma_lantana")
ggplot(mtcars, aes(x = mpg, y = disp, colour = drat)) +
geom_point(size = 4) +
scale_colour_fish(option = "Ostracion_cubicus", direction = -1)