Skip to main content

Color palettes for scientific purposes

Project description

ArtSciColor

PyPI version License: GPL v3 Open Source? Yes! DOI

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, EdnaAndrade, Warhol, Nolde, Monet

Movies

Studio Ghibli

Gaming

Splatoon1, Splatoon2, Splatoon3

Other

chipdelmal, coolors, lospec

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, inkipedia, lospec; so please visit and support their work!


Coded by: Héctor M. Sánchez C.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ArtSciColor-0.2.0.1.tar.gz (59.6 kB view details)

Uploaded Source

Built Distribution

ArtSciColor-0.2.0.1-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

Details for the file ArtSciColor-0.2.0.1.tar.gz.

File metadata

  • Download URL: ArtSciColor-0.2.0.1.tar.gz
  • Upload date:
  • Size: 59.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for ArtSciColor-0.2.0.1.tar.gz
Algorithm Hash digest
SHA256 9c8243a00d4e11bde09a120b8476f83926c42401fc4c0195a4410087179016aa
MD5 7d6eebe6f6ae0ba7affb6a98f2f37ca4
BLAKE2b-256 768e180ea1040613943bddac79cfe3f101654d1775c5b9d41b1e1dd29e97b5ab

See more details on using hashes here.

File details

Details for the file ArtSciColor-0.2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ArtSciColor-0.2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cb7de3f2bdaca89911f66ff0c3a5140f2b2136ccf2cca456ed55aceb43e108d
MD5 3cbd62d5833d50227a749578445ff3f1
BLAKE2b-256 9a7f3d5ef2541636df2c6d03958348e302f24a8794b062d14e893eb0397e8dd5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page