ggGenshin

a collection of Genshin-styled color schemes

View the Project on GitHub RestlessTail/ggGenshin

Home
Usage
Install
APIs
Gallary

Usage

Install

R

Use package manager to install ggGenshin online:

Like most R packages on GitHub, you can install ggGenshin by using devtools::install_github. Paste the code to the R console to install ggGenshin from GitHub.

devtools::install_github("RestlessTail/ggGenshin")

Install ggGenshin from source code:

You can also install ggGenshin from source code. Download the source code from release page and paste the code to the R console to install ggGenshin from source code (replace SourceFileOfggGenshin.tar.gz with the file you downloaded).

install.packages("SourceFileOfggGenshin.tar.gz", type = "source", repos = NULL)

Python

Use pip to install ggGenshinPy online:

Using pip is the easiest way to install ggGenshinPy. Paste the code to your console and install ggGenshinPy from GitHub.

pip install git+https://github.com/RestlessTail/ggGenshin@master-python

Install *.whl file:

You can also download *.whl file from release page to install ggGenshinPy under the off-line condition. Paste the code to your console and install ggGenshinPy from GitHub (replace whlFileOfggGenshin.whl with the file you downloaded).

pip install whlFileOfggGenshin.whl

APIs

R

The R interface of ggGenshin mimics ggsci and four sets of APIs are provided.

Introduce ggGenshin to your project:

Once ggGenshin installed, you can introduce the package to your project by using library function.

library("ggGenshin")

scale_color_* and scale_colour_*:

Mimicking the scale_color_* function of ggsci, it returns a ggplot color scale

Parameters:

Return: a ggplot color scale.

Examples:

scale_color_albedo()
scale_color_albedo(FALSE)
scale_color_albedo(alpha = 0.5)
scale_color_albedo(FALSE, alpha = 0.7, reverse = TRUE)

scale_fill_*:

Mimicking the scale_fill_* function of ggsci, it returns a ggplot color scale

Parameters:

Return: a ggplot color scale.

Examples:

scale_fill_albedo()
scale_fill_albedo(FALSE)
scale_fill_albedo(alpha = 0.5)
scale_fill_albedo(FALSE, alpha = 0.7, reverse = TRUE)

pal_*:

Mimicking the pal_* function of ggsci, it returns a function which returns a vector of hexadecimal colors.

Parameters:

Return: a function that returns a vector of hexadecimal colors.

Examples:

pal_albedo()(10)
pal_albedo(alpha = 0.5)(10)
pal_albedo(alpha = 0.5, reverse = TRUE)(20)

rgb_*:

Mimicking the rgb_* function of ggsci, it returns a vector of hexadecimal colors.

Parameters:

Return: a vector of hexadecimal colors.

Examples:

rgb_albedo()
rgb_albedo(10)
rgb_albedo(n = 10, alpha = 0.5)
rgb_albedo(n = 20, alpha = 0.7, reverse = TRUE)

keys:

returns the available key names, as well as the full names in both Chinese and English.

Return: a data frame.

Examples:

ggGenshin::keys()

Python

Introduce ggGenshinPy to your project:

Once ggGenshin installed, you can introduce the package to your project by using import command.

from ggGenshinPy import colormap as ggg
import ggGenshinPy.colormap as ggg # You can also use this command

cmap*:

Returns a Matplotlib colormap object.

Parameters:

Return: a Matplotlib colormap object.

Examples:

ggg.cmapYoimiya()
ggg.cmapYoimiya(listed = True) # create a listed colormap

keys:

Print available key names, as well as the full names in both Chinese and English.

Examples:

ggg.keys()