Title: | Tintin Palette Generator |
---|---|
Description: | Palettes generated from Tintin covers. There is one palette per cover, with a total of 24 palettes of 5 colours each. Includes functions to interpolate colors in order to create more colors based on the provided palettes. The data is based on Cyr, et al. (2004) <doi:10.1503/cmaj.1041405> and Wikipedia <https://en.wikipedia.org/wiki/The_Adventures_of_Tintin>. |
Authors: | Mauricio Vargas Sepulveda [aut, cre] |
Maintainer: | Mauricio Vargas Sepulveda <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2 |
Built: | 2024-10-29 04:31:52 UTC |
Source: | https://github.com/pachadotdev/tintin |
The tintin
scales provide colour maps for the different Tintin
covers.
scale_colour_tintin_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", aesthetics = "colour" ) scale_colour_tintin_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", values = NULL, na.value = "grey50", guide = "colourbar", aesthetics = "colour" ) scale_fill_tintin_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", aesthetics = "fill" ) scale_fill_tintin_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", values = NULL, na.value = "grey50", guide = "colourbar", aesthetics = "fill" )
scale_colour_tintin_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", aesthetics = "colour" ) scale_colour_tintin_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", values = NULL, na.value = "grey50", guide = "colourbar", aesthetics = "colour" ) scale_fill_tintin_d( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", aesthetics = "fill" ) scale_fill_tintin_c( ..., alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus", values = NULL, na.value = "grey50", guide = "colourbar", aesthetics = "fill" )
... |
Other arguments passed on to |
alpha |
The alpha transparency, a number in |
begin |
The (corrected) hue in |
end |
The (corrected) hue in |
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 color map option to use. Options are available:
|
aesthetics |
Character string or vector of character strings listing the
name(s) of the aesthetic(s) that this scale works with. This can be useful, for
example, to apply colour settings to the |
values |
if colours should not be evenly positioned along the gradient this vector gives the position (between 0 and 1) for each colour in the colours vector. |
na.value |
If |
guide |
A function used to create a guide or its name. See
|
A ggproto
object for use with ggplot2
.
library(dplyr) library(ggplot2) library(tintin) total_head_trauma <- tintin_head_trauma %>% arrange(-loss_of_consciousness_length) %>% filter(row_number() <= 5) # discrete scale ggplot(total_head_trauma) + geom_col(aes(x = cause_of_injury, y = loss_of_consciousness_length, fill = book_title), position = "dodge") + labs(x = "Cause of injury", y = "Loss of consciousness length", title = "Top five causes of injury") + theme_minimal() + scale_fill_tintin_d(option = "cigars_of_the_pharaoh", direction = -1) + coord_flip() # continuous scale # continuous scale ggplot(total_head_trauma) + geom_col(aes( x = cause_of_injury, y = loss_of_consciousness_length, fill = year ), position = "dodge") + labs( x = "Cause of injury", y = "Loss of consciousness length", title = "Top five causes of injury" ) + theme_minimal() + scale_fill_tintin_c(option = "cigars_of_the_pharaoh", direction = -1)
library(dplyr) library(ggplot2) library(tintin) total_head_trauma <- tintin_head_trauma %>% arrange(-loss_of_consciousness_length) %>% filter(row_number() <= 5) # discrete scale ggplot(total_head_trauma) + geom_col(aes(x = cause_of_injury, y = loss_of_consciousness_length, fill = book_title), position = "dodge") + labs(x = "Cause of injury", y = "Loss of consciousness length", title = "Top five causes of injury") + theme_minimal() + scale_fill_tintin_d(option = "cigars_of_the_pharaoh", direction = -1) + coord_flip() # continuous scale # continuous scale ggplot(total_head_trauma) + geom_col(aes( x = cause_of_injury, y = loss_of_consciousness_length, fill = year ), position = "dodge") + labs( x = "Cause of injury", y = "Loss of consciousness length", title = "Top five causes of injury" ) + theme_minimal() + scale_fill_tintin_c(option = "cigars_of_the_pharaoh", direction = -1)
This function creates a vector of colours along the selected colour map.
tintin_clrs( n = 5, alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus" )
tintin_clrs( n = 5, alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus" )
n |
The number of colors ( |
alpha |
The alpha transparency, a number in |
begin |
The (corrected) hue in |
end |
The (corrected) hue in |
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 color map option to use. Options are available with tidy names (i.e., 'the_blue_lotus'):
|
Check the README for the display of the color palettes.
Semi-transparent colors () are supported only on some
devices (see
rgb
).
A character
vector of colors.
# without extrapolation: 5 or fewer colors n <- 5 tintin_clrs(n, option = "the_blue_lotus") image( 1:n, 1, as.matrix(1:n), col = tintin_clrs(n, option = "the_blue_lotus"), xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" ) # with extrapolation: 6 or more colors n <- 20 image( 1:n, 1, as.matrix(1:n), col = tintin_clrs(n, option = "the_blue_lotus"), xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" )
# without extrapolation: 5 or fewer colors n <- 5 tintin_clrs(n, option = "the_blue_lotus") image( 1:n, 1, as.matrix(1:n), col = tintin_clrs(n, option = "the_blue_lotus"), xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" ) # with extrapolation: 6 or more colors n <- 20 image( 1:n, 1, as.matrix(1:n), col = tintin_clrs(n, option = "the_blue_lotus"), xlab = "Tintin darkblue n", ylab = "", xaxt = "n", yaxt = "n", bty = "n" )
A list with 23 vectors (one per Tintin book) containing the five most frequent colors per cover. White tones were removed to balance the palettes. Alph-Art is Herge's unfinished book, it was published posthumously, so we don't consider it in the list.
tintin_colours
tintin_colours
A list with 23 vectors.
Tintin covers obtained from Wikipedia and processed with ImageMagick.
head(tintin_colours)
head(tintin_colours)
Neurological traumas sustained by the subject (by book title)
tintin_head_trauma
tintin_head_trauma
A data frame with 50 rows and 4 variables
year
Release year of the comic, first occurrence was used for titles with a b&w and colour edition
book_title
English title of the books
page
Page number where the traumas happen
cause_of_injury
What causes the trauma (i.e., explosion)
loss_of_consciousness_length
Loss of consciousness length measured by the number of cartoon frames before subject returns to normal activity.
loss_of_consciousness_severity
Loss of consciousness severity measured by the number of objects revolving above Tintin's head
Cyr, Antoine, Louis-Olivier Cyr, and Claude Cyr. "Acquired growth hormone deficiency and hypogonadotropic hypogonadism in a subject with repeated head trauma, or Tintin goes to the neurologist." CMAJ 171, no. 12 (2004): 1433-1434. The book release year was obtained from Wikipedia.
tintin_head_trauma
tintin_head_trauma
A wrapper function around Tintin_clrs
to
turn it into a palette function compatible with
discrete_scale
.
tintin_pal( alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus" )
tintin_pal( alpha = 1, begin = 0, end = 1, direction = 1, option = "the_blue_lotus" )
alpha |
The alpha transparency, a number in |
begin |
The (corrected) hue in |
end |
The (corrected) hue in |
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 color map option to use. Options are available:
|
See Tintin_clrs
for more information on the color palettes.
A function that takes an integer argument and returns a character
vector of colors.
tintin_pal() scales::show_col(tintin_pal()(5))
tintin_pal() scales::show_col(tintin_pal()(5))