colormap

Utilities to visualise and create matplotlib colormaps and various color codecs

https://github.com/cokelaer/colormap

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Utilities to visualise and create matplotlib colormaps and various color codecs

Basic Info
  • Host: GitHub
  • Owner: cokelaer
  • License: bsd-3-clause
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 719 KB
Statistics
  • Stars: 35
  • Watchers: 2
  • Forks: 7
  • Open Issues: 3
  • Releases: 6
Created almost 12 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.rst

#############################
COLORMAP documentation
#############################


.. image:: https://raw.githubusercontent.com/cokelaer/colormap/main/doc/source/_static/colormap_logo_256.png
    :target: https://raw.githubusercontent.com/cokelaer/colormap/main/doc/source/_static/colormap_logo_256.png

.. image:: https://badge.fury.io/py/colormap.svg
    :target: https://pypi.python.org/pypi/colormap

.. image:: https://github.com/cokelaer/colormap/actions/workflows/ci.yml/badge.svg?branch=main
    :target: https://github.com/cokelaer/colormap/actions/workflows/ci.yml

.. image:: https://coveralls.io/repos/cokelaer/colormap/badge.png?branch=main
    :target: https://coveralls.io/r/cokelaer/colormap?branch=main

.. image:: https://static.pepy.tech/personalized-badge/colormap?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads
    :target: https://pepy.tech/project/colormap

.. image:: http://readthedocs.org/projects/colormap/badge/?version=main
    :target: http://colormap.readthedocs.org/en/latest/?badge=main
    :alt: Documentation Status




:version: Python 3.9, 3.10, 3.11, 3.12
:contributions: Please join https://github.com/cokelaer/colormap
:issues: Please use https://github.com/cokelaer/colormap/issues
:notebook: Please see https://github.com/cokelaer/colormap/tree/main/notebooks


What is it ?
################

**colormap** package provides utilities to convert colors between
RGB, HEX, HLS, HUV and a framework to easily create and build colormaps for matplotlib. All
matplotlib colormaps and some R colormaps are also available altogether. The
plot_colormap method (see below) is handy to quickly pick up a colormaps and
the test_colormap is useful to see a live version of the new colormap.


Installation
###################

::

    pip install colormap

Usage examples
###############

1. convert RGB to HEX:

::

    from colormap import rgb2hex, hex2rgb

    hex_color = rgb2hex(255, 0, 0)  # Red color in HEX
    print(hex_color)  # Output: "#ff0000"

    rgb_color = hex2rgb("#ff0000")  # Convert back to RGB
    print(rgb_color)  # Output: (255, 0, 0)

2. Generate a Custom colormap:

Create your own colormap. For instance, from red to green colors with intermediate color as
whitish (diverging map from red to green)::

      from colormap import Colormap
      c = Colormap()
      mycmap = c.cmap( {'red':[1,1,0], 'green':[0,1,.39], 'blue':[0,1,0]})
      cmap = c.test_colormap(mycmap)

Even simpler if the colormap is linear using color's name::

      from colormap import Colormap
      c = Colormap()
      mycmap = c.cmap_linear('red', 'white', 'green(w3c)')
      cmap = c.test_colormap(mycmap)

.. image:: https://colormap.readthedocs.io/en/latest/_images/quickstart-6.png
    :width: 50%
    :align: center

3. Visualise existing matplotlib colormap:

::

      from colormap import plot_colormap, plot_category
      plot_colormap("viridis")


Using the Colormap instance, you can see all valid names using::

      c.colormaps

Matplotlib is very well known in the PYthon ecosystem and has categorised colormaps into categories such as a
"diverging". To visualise all of them::

      plot_category('diverging')

.. image:: https://colormap.readthedocs.io/en/latest/_images/quickstart-4.png
    :width: 50%
    :align: center

Other sets of colormaps are : sequentials, sequentials2, misc, diverging, qualitative



See online documentation for details: http://colormap.readthedocs.io/

changelog
#########

========= ================================================================================
Version   Description
========= ================================================================================
1.3.0     * support for poetry 2.0 thanks to @cjwatson PR#26
          * Slightly better doc
1.2.0
1.1.0     * switch to pyproject. remove easydev dependency. compat for python 3.11 and
            3.12
1.0.6     * Fix a matplotlib deprecation
          * Fix RTD documentation
1.0.5     * remove Python3.6 and added Python3.10 to CI action
          * Fix issue in setup reported in https://github.com/cokelaer/colormap/pull/14
          * add requirements in MANIFEST
          * applied black on all files
========= ================================================================================

Owner

  • Name: Thomas Cokelaer
  • Login: cokelaer
  • Kind: user
  • Location: Paris, France
  • Company: Institut Pasteur

Bioinformatician, Scientific Software Developer, Python developer

GitHub Events

Total
  • Create event: 1
  • Issues event: 3
  • Release event: 1
  • Issue comment event: 4
  • Push event: 23
  • Pull request review event: 1
  • Pull request event: 3
  • Fork event: 2
Last Year
  • Create event: 1
  • Issues event: 3
  • Release event: 1
  • Issue comment event: 4
  • Push event: 23
  • Pull request review event: 1
  • Pull request event: 3
  • Fork event: 2

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 107
  • Total Committers: 6
  • Avg Commits per committer: 17.833
  • Development Distribution Score (DDS): 0.065
Past Year
  • Commits: 11
  • Committers: 1
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thomas Cokelaer c****r@g****m 100
Miroslav Šedivý 6****o 3
Marcelo m****i@h****m 1
Mike Shriver m****r@r****m 1
Abel Serrano Juste a****5@g****m 1
Erik Jan de Vries e****s 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 18
  • Total pull requests: 12
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 3 months
  • Total issue authors: 14
  • Total pull request authors: 8
  • Average comments per issue: 0.78
  • Average comments per pull request: 1.08
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cokelaer (4)
  • Adamtaranto (2)
  • apiszcz (1)
  • lucasglasner (1)
  • mvrozanti (1)
  • hyandell (1)
  • Donnyvdm (1)
  • tillea (1)
  • Akronix (1)
  • Liaoqing-up (1)
  • jobevers (1)
  • bersbersbers (1)
  • liangwang0734 (1)
Pull Request Authors
  • eumiro (5)
  • cokelaer (4)
  • cjwatson (2)
  • mvrozanti (1)
  • erikjandevries (1)
  • mshriver (1)
  • bicarlsen (1)
  • Akronix (1)
Top Labels
Issue Labels
bug (4) enhancement (2)
Pull Request Labels
bug (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 34,632 last-month
  • Total docker downloads: 15
  • Total dependent packages: 11
    (may contain duplicates)
  • Total dependent repositories: 85
    (may contain duplicates)
  • Total versions: 22
  • Total maintainers: 1
pypi.org: colormap

Commn utilities to ease development of Python packages

  • Versions: 21
  • Dependent Packages: 10
  • Dependent Repositories: 85
  • Downloads: 34,632 Last month
  • Docker Downloads: 15
Rankings
Dependent packages count: 1.3%
Docker downloads count: 1.3%
Dependent repos count: 1.6%
Downloads: 2.5%
Average: 4.9%
Stargazers count: 11.1%
Forks count: 11.9%
Maintainers (1)
Last synced: 11 months ago
conda-forge.org: colormap
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Average: 38.1%
Stargazers count: 42.0%
Forks count: 47.7%
Last synced: 11 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
.github/workflows/pypi.yml actions
  • actions/checkout main composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish release/v1 composite
doc/requirements.txt pypi
  • pillow <=9.5.0
  • sequana_sphinxext *
  • sphinx <7
  • sphinx_rtd_theme *
pyproject.toml pypi
  • coveralls ^3.3.1 develop
  • flaky ^3.7.0 develop
  • pytest ^7.4.4 develop
  • pytest-cov ^4.1.0 develop
  • pytest-mock ^3.12.0 develop
  • pytest-runner ^6.0.1 develop
  • pytest-xdist ^3.5.0 develop
  • sphinx >3 doc
  • sphinx-gallery ^0.15.0 doc
  • sphinx-rtd-theme ^2.0.0 doc
  • matplotlib ^3.8.4
  • python ^3.9
setup.py pypi