Skip to content

jefferyUstc/chinacolor-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChinaColor-python

Chinese traditional colors and palettes for matplotlib/seaborn. The Python Version of chinacolor

Features

  • 384 traditional colors
  • 60 predefined palettes (sequential/diverging/qualitative)
  • Utilities to get palettes as color lists or matplotlib colormaps
  • Helper plotting to preview palettes
    • plot_palette, plot_palettes, plot_color_grid
  • DataFrame helpers (require pandas): colors_df(), palettes_df(), alias list_colors()
  • Themes for matplotlib/seaborn: theme_ctc_paper, theme_ctc_mineral, theme_ctc_ink, theme_ctc_bronze, theme_ctc_dunhuang
  • Recommended palettes per-theme (categorical/sequential/diverging)

Install (local)

  • From this folder: pip install -e .[seaborn]
  • With pandas helpers: pip install -e .[pandas,seaborn]

Quickstart

import chinacolor as ctc
from matplotlib import pyplot as plt

# Discrete palette for categorical hue
colors = ctc.get_palette("qual15", n=6)

# Continuous colormap for scalar values
cmap = ctc.get_cmap("seq05")

# Seaborn usage
import seaborn as sns
ax = sns.scatterplot(data=sns.load_dataset("iris"), x="sepal_length", y="sepal_width", hue="species", palette=colors)

# Matplotlib with colormap
import numpy as np
Z = np.random.RandomState(0).randn(50, 50)
plt.imshow(Z, cmap=ctc.get_cmap("div13", direction=-1))

# Preview a palette
ctc.plot_palette("seq08")

About

Python version of chinacolor, Chinese style color palettes for matplotlib and seaborn

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published