Coder Social home page Coder Social logo

chipdelmal / artscicolor Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3.46 MB

A python package to provide with color palettes and auxiliary tools for data visualization.

License: GNU General Public License v3.0

Python 7.91% Makefile 0.26% Shell 0.52% HTML 91.31%
cmap color color-palettes data-visualization dataviz matplotlib palettes

artscicolor's Introduction

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.

🚧 WORK IN PROGRESS 🚧

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!

Miro, Kandinsky, Kirchner, Matisse, Picasso, Signac, Warhol, Nolde, Monet, VanGogh, EdnaAndrade, DarbyBannard, UmbertoBoccioni

Studio Ghibli, Disney

Splatoon1, Splatoon2, Splatoon3

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.

artscicolor's People

Contributors

chipdelmal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.