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 |
convert_colTodf
This function convert color data to list class.
convert_colTodf(coldata)
convert_colTodf(coldata)
coldata |
Color data. |
list class containing palette name (or color name), original color data (data.frame), column name, and row name.
convert_colTodf(coldata = c("red", "#ff48ac"))
convert_colTodf(coldata = c("red", "#ff48ac"))
image_add_textAcode
This function add to image() command text and color code.
image_add_textAcode( coldata, xlab = NULL, ylab = NULL, colornames = "color", showcode = TRUE )
image_add_textAcode( coldata, xlab = NULL, ylab = NULL, colornames = "color", showcode = TRUE )
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. |
Display hex color code and color on console.
image_add_textAcode(coldata = t(as.matrix(c("red", "#ff48ac"))), colornames = "color", showcode = TRUE)
image_add_textAcode(coldata = t(as.matrix(c("red", "#ff48ac"))), colornames = "color", showcode = TRUE)
kg_create_cc
This function create complementary color.
kg_create_cc(basecols = c("#ff48ac", "red"), alpha = 1)
kg_create_cc(basecols = c("#ff48ac", "red"), alpha = 1)
basecols |
Set color data. |
alpha |
The alpha transparency. Numbers range from 0-1.
see argument alpha in |
Return base and complementary color in a data frame
kg_show_console(kg_create_cc()) kg_plot_color(color = kg_create_cc())
kg_show_console(kg_create_cc()) kg_plot_color(color = kg_create_cc())
kg_create_tc
This function create triad color.
kg_create_tc(basecols = "#4E5C78", alpha = 1)
kg_create_tc(basecols = "#4E5C78", alpha = 1)
basecols |
Set basecol color data. |
alpha |
The alpha transparency. Numbers range from 0-1.
see argument alpha in |
Return triad color in a data frame
kg_show_console(kg_create_tc()) kg_plot_color(color = kg_create_tc())
kg_show_console(kg_create_tc()) kg_plot_color(color = kg_create_tc())
kg_get_color
This function creates a vector of n
color palette
data for the KaradaColor Package.
kg_get_color(n = 5, name = "Sapporo_Sta", alpha = 1) kg_get_palette(name = "Sapporo_Sta", alpha = 1)
kg_get_color(n = 5, name = "Sapporo_Sta", alpha = 1) kg_get_palette(name = "Sapporo_Sta", alpha = 1)
n |
Number of colors to create. |
name |
color palette name. (default: |
alpha |
The alpha transparency. Numbers range from 0-1. see argument
alpha in |
Vector containing a hex color code representation for the chosen palette.
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)
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)
kg_plot_color
This function draw the color data.
kg_plot_color(name = "Sapporo_Sta", color = NULL, n = 5, showcode = TRUE)
kg_plot_color(name = "Sapporo_Sta", color = NULL, n = 5, showcode = TRUE)
name |
Color palette color palette name. (default: |
color |
Color data. Precedence over name except NULL. (default: NULL) |
n |
Number of colors to create. |
showcode |
Add a color code to the plot. |
Vector containing a hex color code representation for the chosen palette
#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)
#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)
kg_show_console
This function draws display the color palette data set
in the console.
kg_show_console(x = df_KG_palettes) console_col(x)
kg_show_console(x = df_KG_palettes) console_col(x)
x |
color palette data. |
Vector containing a hex color code representation for the chosen palette
kg_show_console()
kg_show_console()
scale_color_kg Use color palette on 'ggplot2' colors.
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 )
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 )
name |
color palette name. (default: |
alpha |
The alpha transparency. Numbers range from 0-1. see argument
alpha in |
na.value |
Color of missing value. |
discrete |
Generate a discrete palette. ( |
Create a user defined color palette for ggplot2.
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()
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()
scale_fill_kg
Use color palette on 'ggplot2' fills.
scale_fill_kg( name = "Sapporo_Sta", alpha = 1, na.value = "red", discrete = TRUE )
scale_fill_kg( name = "Sapporo_Sta", alpha = 1, na.value = "red", discrete = TRUE )
name |
color palette name. (default: |
alpha |
The alpha transparency. Numbers range from 0-1.
see argument alpha in |
na.value |
Color of missing value.(default: "red") |
discrete |
Generate a discrete palette.
( |
Create a user defined color palette for 'ggplot2'.
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")
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")