.. -*- mode: rst -*-
.. image:: doc/glasbey_logo.png
:width: 600
:alt: Glasbey logo
:align: center
|pypi_version|_ |License|_ |build_status|_ |Coverage|_ |Docs|_
.. |pypi_version| image:: https://img.shields.io/pypi/v/glasbey.svg
.. _pypi_version: https://pypi.python.org/pypi/glasbey/
.. |License| image:: https://img.shields.io/pypi/l/glasbey
.. _License: https://github.com/lmcinnes/glasbey/blob/main/LICENSE
.. |build_status| image:: https://dev.azure.com/lelandmcinnes/Glasbey%20builds/_apis/build/status/lmcinnes.glasbey?branchName=main
.. _build_status: https://dev.azure.com/lelandmcinnes/Glasbey%20builds/_build/latest?definitionId=2&branchName=main
.. |Coverage| image:: https://coveralls.io/repos/github/lmcinnes/glasbey/badge.svg?branch=HEAD
.. _Coverage: https://coveralls.io/github/lmcinnes/glasbey
.. |Docs| image:: https://readthedocs.org/projects/glasbey/badge/?version=latest
.. _Docs: https://glasbey.readthedocs.io/en/latest/?badge=latest
=======================================
Glasbey Categorical Color Palette Tools
=======================================
The glasbey library allows for the algorithmic creation of colour palettes designed for use with categorical data
using techniques from the paper Colour Displays for Categorical Images by Glasbey, Heijden, Toh and Gray. You don't
need to worry about the technical details however -- the glasbey library is easy to use.
It is quite common to require a colour palette for some categorical data such that each category has a visually
distinctive colour. Usually one relies upon predefined colour palettes such as those from
`ColorBrewer <https://colorbrewer2.org/#type=qualitative&scheme=Accent&n=3>`_, or provided by your plotting library of
choice. Unfortunately such palettes do not always meet your needs: perhaps they don't have enough distinct colours and
you don't want to re-use or cycle the palette; perhaps you have specific constraints you want to apply to get a
certain look to your palette. Fortunately we can use math and perceptual colour spaces to create new palettes that
maximize the perceptual visual distinctiveness of colours within constraints. It is also easy to extend an
existing palette, or seed a created palette with some initial colours (perhaps your company or institutions colours).
Lastly, glasbey makes it easy to generate block palettes, suitable for working with hierarchical categories.
Create categorical palettes
.. image:: doc/glasbey_basic_palette.png
:width: 600
:alt: Glasbey basic palette example
:align: center
or constrain the palette options (e.g. to muted colours)
.. image:: doc/glasbey_muted_palette.png
:width: 600
:alt: Glasbey muted palette example
:align: center
or extend existing palettes
.. image:: doc/glasbey_tab10_palette.png
:width: 600
:alt: Glasbey extending tab10 example
:align: center
or create block categorical palettes
.. image:: doc/glasbey_block_palette.png
:width: 600
:alt: Glasbey block palette example
:align: center
-----------
Basic Usage
-----------
Creating new categorical colour palettes is as easy as single function call.
.. code:: python3
import glasbey
# Create a categorical palette with 15 colours
glasbey.create_palette(palette_size=15)
# Create a muted palette with 12 colours
glasbey.create_palette(palette_size=12, lightness_bounds=(20, 40), chroma_bounds=(40, 50))
It is also easy to extend an existing palette, or create a new palette from some seed colours.
.. code:: python3
import glasbey
# Add an extra 5 colours to matplotlib's tab10 palette
glasbey.extend_palette("tab10", palette_size=15)
# Seed a palette with some initial colours
glasbey.extend_palette(["#2a3e63", "#7088b8", "#fcaf3e", "#b87088"], palette_size=8)
------------
Installation
------------
Glasbey requires:
* numba
* numpy
* colorspacious
* matplotlib
Glasbey can be installed via pip:
.. code:: bash
pip install glasbey
To manually install this package:
.. code:: bash
wget https://github.com/lmcinnes/glasbey/archive/main.zip
unzip main.zip
rm main.zip
cd glasbey-main
python setup.py install
----------------
Acknowledgements
----------------
This library is heavily indebted to the `original glasbey library <https://github.com/taketwo/glasbey>`_ by Sergey Alexandrov.
----------
References
----------
1) Glasbey, C., van der Heijden, G., Toh, V. F. K. and Gray, A. (2007),
`Colour Displays for Categorical Images <http://onlinelibrary.wiley.com/doi/10.1002/col.20327/abstract>`_.
Color Research and Application, 32: 304-309
2) Luo, M. R., Cui, G. and Li, C. (2006), `Uniform Colour Spaces Based on CIECAM02 Colour Appearance Model <http://onlinelibrary.wiley.com/doi/10.1002/col.20227/abstract>`_.
Color Research and Application, 31: 320–330
-------
License
-------
Glasbey is MIT licensed. See the LICENSE file for details.
------------
Contributing
------------
Contributions are more than welcome! If you have ideas for features of projects please get in touch. Everything from
code to notebooks to examples and documentation are all *equally valuable* so please don't feel you can't contribute.
To contribute please `fork the project <https://github.com/lmcinnes/glasbey/issues#fork-destination-box>`_ make your
changes and submit a pull request. We will do our best to work through any issues with you and get your code merged in.
Raw data
{
"_id": null,
"home_page": "https://github.com/lmcinnes",
"name": "glasbey",
"maintainer": "Leland McInnes",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "leland.mcinnes@gmail.com",
"keywords": "color, palette, categorical",
"author": "Leland McInnes",
"author_email": "leland.mcinnes@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/30/50/42f45cce30244656fa4fd28c777523e65f4c69fe26ca927d4cf43e944f99/glasbey-0.2.1.tar.gz",
"platform": null,
"description": ".. -*- mode: rst -*-\n\n.. image:: doc/glasbey_logo.png\n :width: 600\n :alt: Glasbey logo\n :align: center\n\n|pypi_version|_ |License|_ |build_status|_ |Coverage|_ |Docs|_\n\n.. |pypi_version| image:: https://img.shields.io/pypi/v/glasbey.svg\n.. _pypi_version: https://pypi.python.org/pypi/glasbey/\n\n.. |License| image:: https://img.shields.io/pypi/l/glasbey\n.. _License: https://github.com/lmcinnes/glasbey/blob/main/LICENSE\n\n.. |build_status| image:: https://dev.azure.com/lelandmcinnes/Glasbey%20builds/_apis/build/status/lmcinnes.glasbey?branchName=main\n.. _build_status: https://dev.azure.com/lelandmcinnes/Glasbey%20builds/_build/latest?definitionId=2&branchName=main\n\n.. |Coverage| image:: https://coveralls.io/repos/github/lmcinnes/glasbey/badge.svg?branch=HEAD\n.. _Coverage: https://coveralls.io/github/lmcinnes/glasbey\n\n.. |Docs| image:: https://readthedocs.org/projects/glasbey/badge/?version=latest\n.. _Docs: https://glasbey.readthedocs.io/en/latest/?badge=latest\n\n\n=======================================\nGlasbey Categorical Color Palette Tools\n=======================================\n\nThe glasbey library allows for the algorithmic creation of colour palettes designed for use with categorical data\nusing techniques from the paper Colour Displays for Categorical Images by Glasbey, Heijden, Toh and Gray. You don't\nneed to worry about the technical details however -- the glasbey library is easy to use.\n\nIt is quite common to require a colour palette for some categorical data such that each category has a visually\ndistinctive colour. Usually one relies upon predefined colour palettes such as those from\n`ColorBrewer <https://colorbrewer2.org/#type=qualitative&scheme=Accent&n=3>`_, or provided by your plotting library of\nchoice. Unfortunately such palettes do not always meet your needs: perhaps they don't have enough distinct colours and\nyou don't want to re-use or cycle the palette; perhaps you have specific constraints you want to apply to get a\ncertain look to your palette. Fortunately we can use math and perceptual colour spaces to create new palettes that\nmaximize the perceptual visual distinctiveness of colours within constraints. It is also easy to extend an\nexisting palette, or seed a created palette with some initial colours (perhaps your company or institutions colours).\nLastly, glasbey makes it easy to generate block palettes, suitable for working with hierarchical categories.\n\nCreate categorical palettes\n\n.. image:: doc/glasbey_basic_palette.png\n :width: 600\n :alt: Glasbey basic palette example\n :align: center\n\nor constrain the palette options (e.g. to muted colours)\n\n.. image:: doc/glasbey_muted_palette.png\n :width: 600\n :alt: Glasbey muted palette example\n :align: center\n\nor extend existing palettes\n\n.. image:: doc/glasbey_tab10_palette.png\n :width: 600\n :alt: Glasbey extending tab10 example\n :align: center\n\nor create block categorical palettes\n\n.. image:: doc/glasbey_block_palette.png\n :width: 600\n :alt: Glasbey block palette example\n :align: center\n\n-----------\nBasic Usage\n-----------\n\nCreating new categorical colour palettes is as easy as single function call.\n\n.. code:: python3\n\n import glasbey\n\n # Create a categorical palette with 15 colours\n glasbey.create_palette(palette_size=15)\n # Create a muted palette with 12 colours\n glasbey.create_palette(palette_size=12, lightness_bounds=(20, 40), chroma_bounds=(40, 50))\n\nIt is also easy to extend an existing palette, or create a new palette from some seed colours.\n\n.. code:: python3\n\n import glasbey\n\n # Add an extra 5 colours to matplotlib's tab10 palette\n glasbey.extend_palette(\"tab10\", palette_size=15)\n # Seed a palette with some initial colours\n glasbey.extend_palette([\"#2a3e63\", \"#7088b8\", \"#fcaf3e\", \"#b87088\"], palette_size=8)\n\n------------\nInstallation\n------------\n\nGlasbey requires:\n\n * numba\n * numpy\n * colorspacious\n * matplotlib\n\nGlasbey can be installed via pip:\n\n.. code:: bash\n\n pip install glasbey\n\nTo manually install this package:\n\n.. code:: bash\n\n wget https://github.com/lmcinnes/glasbey/archive/main.zip\n unzip main.zip\n rm main.zip\n cd glasbey-main\n python setup.py install\n\n----------------\nAcknowledgements\n----------------\n\nThis library is heavily indebted to the `original glasbey library <https://github.com/taketwo/glasbey>`_ by Sergey Alexandrov.\n\n----------\nReferences\n----------\n\n1) Glasbey, C., van der Heijden, G., Toh, V. F. K. and Gray, A. (2007),\n `Colour Displays for Categorical Images <http://onlinelibrary.wiley.com/doi/10.1002/col.20327/abstract>`_.\n Color Research and Application, 32: 304-309\n\n2) Luo, M. R., Cui, G. and Li, C. (2006), `Uniform Colour Spaces Based on CIECAM02 Colour Appearance Model <http://onlinelibrary.wiley.com/doi/10.1002/col.20227/abstract>`_.\n Color Research and Application, 31: 320\u2013330\n\n-------\nLicense\n-------\n\nGlasbey is MIT licensed. See the LICENSE file for details.\n\n------------\nContributing\n------------\n\nContributions are more than welcome! If you have ideas for features of projects please get in touch. Everything from\ncode to notebooks to examples and documentation are all *equally valuable* so please don't feel you can't contribute.\nTo contribute please `fork the project <https://github.com/lmcinnes/glasbey/issues#fork-destination-box>`_ make your\nchanges and submit a pull request. We will do our best to work through any issues with you and get your code merged in.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Algorithmically generate categorical color palettes",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/lmcinnes"
},
"split_keywords": [
"color",
" palette",
" categorical"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0a946f2eabcb4b899ce3968d988468f1dd8b15883731ac53efad5572c15a80cd",
"md5": "01559d40ada7272afbca247133c6e3ff",
"sha256": "b36281795183abb845318566a3b34621c2c17d334712e10a86ce3c6714babc03"
},
"downloads": -1,
"filename": "glasbey-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "01559d40ada7272afbca247133c6e3ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14925,
"upload_time": "2024-06-18T20:08:42",
"upload_time_iso_8601": "2024-06-18T20:08:42.684561Z",
"url": "https://files.pythonhosted.org/packages/0a/94/6f2eabcb4b899ce3968d988468f1dd8b15883731ac53efad5572c15a80cd/glasbey-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "305042f45cce30244656fa4fd28c777523e65f4c69fe26ca927d4cf43e944f99",
"md5": "058ab82b57d9859af9318f2a1e05c84a",
"sha256": "d4af86040b918fd510fcfed111d9fe3d86e9c5349d6304bc860470a010d5d242"
},
"downloads": -1,
"filename": "glasbey-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "058ab82b57d9859af9318f2a1e05c84a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 15308,
"upload_time": "2024-06-18T20:08:52",
"upload_time_iso_8601": "2024-06-18T20:08:52.552921Z",
"url": "https://files.pythonhosted.org/packages/30/50/42f45cce30244656fa4fd28c777523e65f4c69fe26ca927d4cf43e944f99/glasbey-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-18 20:08:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "glasbey"
}