Package 'KaradaColor'

Title: Color Palettes Inspired by Japanese Landscape and Culture
Description: The palette includes motifs from Japanese landscape and culture. And it provides commands for color manipulation and 'ggplot2' color scales.
Authors: Masaki Fujishima [aut, cre]
Maintainer: Masaki Fujishima <[email protected]>
License: GPL (>= 3)
Version: 0.1.5
Built: 2025-01-10 15:22:57 UTC
Source: https://github.com/cranhaven/cranhaven.r-universe.dev

Help Index


Convert color data to list class

Description

convert_colTodf This function convert color data to list class.

Usage

convert_colTodf(coldata)

Arguments

coldata

Color data.

Value

list class containing palette name (or color name), original color data (data.frame), column name, and row name.

Examples

convert_colTodf(coldata = c("red", "#ff48ac"))

Add to image() command text and color code

Description

image_add_textAcode This function add to image() command text and color code.

Usage

image_add_textAcode(
  coldata,
  xlab = NULL,
  ylab = NULL,
  colornames = "color",
  showcode = TRUE
)

Arguments

coldata

Color data. Only for matrix class.

xlab

x axis label.

ylab

x axis label.

colornames

Color name.

showcode

Add a color code to the plot.

Value

Display hex color code and color on console.

Examples

image_add_textAcode(coldata = t(as.matrix(c("red", "#ff48ac"))),
                    colornames = "color", showcode = TRUE)

Create complementary color

Description

kg_create_cc This function create complementary color.

Usage

kg_create_cc(basecols = c("#ff48ac", "red"), alpha = 1)

Arguments

basecols

Set color data.

alpha

The alpha transparency. Numbers range from 0-1. see argument alpha in rgb.

Value

Return base and complementary color in a data frame

Examples

kg_show_console(kg_create_cc())
kg_plot_color(color = kg_create_cc())

Create triad color

Description

kg_create_tc This function create triad color.

Usage

kg_create_tc(basecols = "#4E5C78", alpha = 1)

Arguments

basecols

Set basecol color data.

alpha

The alpha transparency. Numbers range from 0-1. see argument alpha in rgb.

Value

Return triad color in a data frame

Examples

kg_show_console(kg_create_tc())
kg_plot_color(color = kg_create_tc())

Get color palette data

Description

kg_get_color This function creates a vector of n color palette data for the KaradaColor Package.

Usage

kg_get_color(n = 5, name = "Sapporo_Sta", alpha = 1)

kg_get_palette(name = "Sapporo_Sta", alpha = 1)

Arguments

n

Number of colors to create.

name

color palette name. (default: "Sapporo_Sta")

alpha

The alpha transparency. Numbers range from 0-1. see argument alpha in rgb.

Value

Vector containing a hex color code representation for the chosen palette.

Examples

library("scales")
show_col(kg_get_color(n = 20, name = "Totan", alpha = 0.5))

library("aRtsy")
set.seed(1234)
canvas_strokes(colors = kg_get_color(name = "Otaru_Unga"),
               neighbors = 1, p = 0.02, iterations = 1,
               resolution = 350)

Draw the color data

Description

kg_plot_color This function draw the color data.

Usage

kg_plot_color(name = "Sapporo_Sta", color = NULL, n = 5, showcode = TRUE)

Arguments

name

Color palette color palette name. (default: "Sapporo_Sta")

color

Color data. Precedence over name except NULL. (default: NULL)

n

Number of colors to create.

showcode

Add a color code to the plot.

Value

Vector containing a hex color code representation for the chosen palette

Examples

#Draw the color palette of the KaradaColor
kg_plot_color(name = "Amanohashidate", n = 5, showcode = FALSE)
#Draw the KG_create_cc command
kg_plot_color(color = kg_create_cc(c("#ff48ac", "yellow")), showcode = TRUE)
#Draw the KG_create_tc command
kg_plot_color(color = kg_create_tc("yellow"), showcode = TRUE)
#Color data
kg_plot_color(color = c("gray"), showcode = FALSE)

Display the color palette data set in the console

Description

kg_show_console This function draws display the color palette data set in the console.

Usage

kg_show_console(x = df_KG_palettes)

console_col(x)

Arguments

x

color palette data.

Value

Vector containing a hex color code representation for the chosen palette

Examples

kg_show_console()

Use color scales on 'ggplot2'

Description

scale_color_kg Use color palette on 'ggplot2' colors.

Usage

scale_color_kg(
  name = "Sapporo_Sta",
  alpha = 1,
  na.value = "red",
  discrete = TRUE
)

scale_colour_kg(
  name = "Sapporo_Sta",
  alpha = 1,
  na.value = "red",
  discrete = TRUE
)

Arguments

name

color palette name. (default: "Sapporo_Sta")

alpha

The alpha transparency. Numbers range from 0-1. see argument alpha in rgb.

na.value

Color of missing value.

discrete

Generate a discrete palette. (FALSE - generate continuous palette)

Value

Create a user defined color palette for ggplot2.

Examples

library("ggplot2")
ggplot(data = diamonds, aes(x = cut, y = price,
                            color = cut, fill = cut)) +
  geom_boxplot() +
  scale_color_kg(name = "Hanamushiro", alpha = 0.2) +
  scale_fill_kg(name = "Hokkaido_Sky", alpha = 0.2) +
  theme_dark()

Use Color fills on 'ggplot2'

Description

scale_fill_kg Use color palette on 'ggplot2' fills.

Usage

scale_fill_kg(
  name = "Sapporo_Sta",
  alpha = 1,
  na.value = "red",
  discrete = TRUE
)

Arguments

name

color palette name. (default: "Sapporo_Sta")

alpha

The alpha transparency. Numbers range from 0-1. see argument alpha in rgb.

na.value

Color of missing value.(default: "red")

discrete

Generate a discrete palette. (FALSE - generate continuous palette)

Value

Create a user defined color palette for 'ggplot2'.

Examples

set.seed(1)
x <- LETTERS[1:20]
y <- paste0("var", seq(1,20))
data <- expand.grid(X=x, Y=y)
data$Z <- sample(c(NA, rnorm(15)), 20, replace = TRUE)
library("ggplot2")
ggplot(data, aes(X, Y, fill= Z)) +
  geom_tile() +
  scale_fill_kg(discrete = FALSE, name = "Hanamushiro",
                alpha = 0.4, na.value = "red")