Color palettes for scientific purposes
Project description
ArtSciColor
Creating a python package with color palettes and utilities for their use in matplotlib, seaborn, plotly, and others.
:construction: WORK IN PROGRESS :construction:
R users or Python users who don't want to install the package but still want to use the palettes, can download them in CSV form from the dataset's permalink!
Installation
The package is available through pypi, so it can be installed by running:
pip install ArtSciColor
Usage
To use a color palette simply load the package and run:
import ArtSciColor as art
hexPalette = art.getSwatch(SWATCH_ID)
where the SWATCH_ID
should match one of the palettes available in our package (see the following section for more info).
Available Swatches
Have a look at currently-available palettes by selecting your favorite artist or category, and use one through its ID
!
Art
Miro, Kandinsky, Kirchner, Matisse, Picasso, Signac, Warhol, Nolde, Monet, VanGogh, EdnaAndrade, DarbyBannard, UmbertoBoccioni
Movies
Gaming
Splatoon1, Splatoon2, Splatoon3
Other
chipdelmal, lospec, institutions, coolors, color-hex, and schemecolor
Full dataframe in CSV for available for download here!
How are the palettes generated?
Getting palette colors is a common exercise for people getting started into clustering methods. The most widely-used algorithm for this task is k-means, but in this package the algorithm and its parameters can be provided as long as they adhere to scikit-learn's standards. Most of the curated palettes were calculated through the agglomerative clustering algorithm as follows:
from sklearn.cluster import AgglomerativeClustering
# Read image and setup number of desired clusters
img = art.readCV2Image(fPath)
CLST_NUM=4
# Clustering algorithm
CLUSTERING = {
'algorithm': AgglomerativeClustering,
'params': {'n_clusters': CLST_NUM}
}
(pixels, labels) = art.calcDominantColors(
img,
cFun=CLUSTERING['algorithm'],
cArgs=CLUSTERING['params']
)
Other algorithms such as DBSCAN and HDBSCAN, Spectral Clustering, OPTICS, etc; can also be used.
Notes and Sources
This package was initially inspired by Blake R Mills' R packages (MoMA Colors and MetBrewer). Most palettes or original artworks are sourced from: NGA, wikiart, staedelemuseum, filmartgallery, coolors, schemecolor, color-hex, inkipedia, lospec; so please visit and support their work!
Coded by: Héctor M. Sánchez C.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ArtSciColor-0.3.3.3.tar.gz
.
File metadata
- Download URL: ArtSciColor-0.3.3.3.tar.gz
- Upload date:
- Size: 77.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3695186093f5f754d66dcfbf7905a7ab387a625e2a1869b26376622b107248d4 |
|
MD5 | 7d1f42dcb68ce2f6939bcd336adcdf61 |
|
BLAKE2b-256 | 38788e4af40ea628308833bf502e9a0b495bd2d75391e19d1604de508c654179 |
File details
Details for the file ArtSciColor-0.3.3.3-py3-none-any.whl
.
File metadata
- Download URL: ArtSciColor-0.3.3.3-py3-none-any.whl
- Upload date:
- Size: 74.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2566266c0d78b8d2d01df8e93bd56fdc7019afed77c83461ffea4da55b078d2e |
|
MD5 | 7c94bedeaeac6c0b23d52f55eef237f3 |
|
BLAKE2b-256 | 343086a0ddd815602d1ae31e6438646a2d9820c6a93a0af4c0c2617d09042f53 |