Skip to content

Commit

Permalink
Merge pull request #14 from 1313e/dev
Browse files Browse the repository at this point in the history
Release of v1.4.0
  • Loading branch information
1313e authored Jul 20, 2020
2 parents a7b2fa3 + 40a2146 commit 4770ca1
Show file tree
Hide file tree
Showing 117 changed files with 9,410 additions and 2,356 deletions.
20 changes: 2 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ If you cannot find your ideal colormap, then please open an `issue`_, provide th
Let's get rid of all bad colormaps in the world together!

*If you use CMasher for your work, then please star the repo, such that I can keep track of how many users it has and more easily raise awareness of bad colormaps.*
*Additionally, if you use CMasher as part of your workflow in a scientific publication, please consider citing the CMasher paper* (*BibTeX:* ``cmr.get_bibtex``).

.. _issue: https://github.com/1313e/CMasher/issues
.. _online documentation: https://cmasher.readthedocs.io
Expand Down Expand Up @@ -74,24 +75,7 @@ So, for example, if one were to use the *rainforest* colormap, this could be don
plt.scatter(x, y, c=z, cmap=cmap, s=300)
plt.show()
If one instead wishes to use a specific *CMasher* colormap without adding dependencies (useful for, e.g., handing in tutorial assignments; quickly sharing work/results with someone; etc.), then one can find stand-alone versions of all colormaps, named ``<cmap_name>/<cmap_name>.py``, in the `cmasher/colormaps`_ directory.
These Python modules can be placed in a local working directory, and can then be imported with ``import <cmap_name>`` (e.g., ``import rainforest`` to register the *rainforest* colormap in *matplotlib* as ``'cmr.rainforest'``).

Accessing the colormaps in other languages than *Python* would require reading in the ``<cmap_name>/<cmap_name>_8bit.txt`` text files in the `cmasher/colormaps`_ directory, which contain the 8-bit RGB values of every colormap, and registering them in the appropriate package in the language manually.
For those that are interested, the *viscm* source files that were used for creating the colormaps can also be found in the `cmasher/colormaps`_ directory in the repo (the source files are not provided with the package distribution).
Note that my modified version of *viscm* (available `here <https://github.com/1313e/viscm>`_) is required in order to properly view and edit the source file of a diverging colormap.

Using custom colormaps
----------------------
*CMasher* allows for custom colormaps to be imported with the ``cmr.import_cmaps`` function (which is executed automatically on the `cmasher/colormaps`_ directory when *CMasher* is imported).
This function takes the path to a colormap file named ``cm_<cmap_name>`` (or the path to a directory containing such files); creates a *matplotlib* ``Colormap`` object using the data in the file; and registers it in *matplotlib* with the name ``'cmr.<cmap_name>'`` (it will also be available in *CMasher* as ``cmr.cm.<cmap_name>``).
A colormap file can either be a JSCM-file as created by *viscm* or a text file that contains the (normalized) RGB values of the colormap (see the text files in the `cmasher/colormaps`_ directory for the structure of such files).
If one wishes to register a colormap using (normalized) RGB values that are already in memory, the ``cmr.register_cmap`` function can be used for this.

Note that colormaps imported/registered this way cannot be accessed through *CMasher* using ``cmr.<cmap_name>``, unlike *CMasher*'s own colormaps, but solely using ``cmr.cm.<cmap_name>`` (access through *matplotlib* is the same as before).
This is to keep official and unofficial colormaps separated in *CMasher*.

.. _cmasher/colormaps: https://github.com/1313e/CMasher/tree/master/cmasher/colormaps
For other use-cases, see the `online documentation`_.


.. |PyPI| image:: https://img.shields.io/pypi/v/CMasher.svg?logo=pypi&logoColor=white&label=PyPI
Expand Down
2 changes: 1 addition & 1 deletion cmasher/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

# %% VERSIONS
# Default/Latest/Current version
__version__ = '1.3.5'
__version__ = '1.4.0'
3 changes: 3 additions & 0 deletions cmasher/colormaps/amber/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Author declaration
__author__ = "Ellert van der Velden (@1313e)"

# Package declaration
__package__ = 'cmasher'


# %% GLOBALS AND DEFINITIONS
# Type of this colormap (according to viscm)
Expand Down
3 changes: 3 additions & 0 deletions cmasher/colormaps/apple/apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Author declaration
__author__ = "Ellert van der Velden (@1313e)"

# Package declaration
__package__ = 'cmasher'


# %% GLOBALS AND DEFINITIONS
# Type of this colormap (according to viscm)
Expand Down
3 changes: 3 additions & 0 deletions cmasher/colormaps/arctic/arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Author declaration
__author__ = "Ellert van der Velden (@1313e)"

# Package declaration
__package__ = 'cmasher'


# %% GLOBALS AND DEFINITIONS
# Type of this colormap (according to viscm)
Expand Down
38 changes: 38 additions & 0 deletions cmasher/colormaps/bubblegum/bubblegum.jscm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"content-type": "application/vnd.matplotlib.colormap-v1+json",
"name": "bubblegum",
"license": "http://creativecommons.org/publicdomain/zero/1.0/",
"usage-hints": [
"red-green-colorblind-safe",
"greyscale-safe",
"sequential"
],
"colorspace": "sRGB",
"domain": "continuous",
"colors": "07223807233a08233b09243c0a243e0b253f0c25410d26420e26440f274510274711284812284a13294c14294d15294f162a50172a52182b54192b551a2b571c2c581d2c5a1e2d5c1f2d5d202d5f212e61222e63232e64242e66252f68262f69282f6b292f6d2a306f2b30702c30722e30742f307630307731317933317b34317d35317e3631803831823931843a31863c31873d31893f318b40318d41318e4331904431924631934731954830974a30984b309a4d309c4e309d502f9f512fa1532fa2542fa4562ea5572ea7592ea85a2ea95c2dab5d2dac5f2dae602caf622cb0632cb1652bb3662bb4682bb5692ab66b2ab76d2ab86e29b97029ba7129bb7328bc7428bd7628be7727bf7927bf7a27c07c27c17d26c27e26c28026c38126c38325c48425c48625c58725c58925c68a25c68b25c78d25c78e25c79025c79125c89225c89425c89525c89725c89826c89926c89b26c99c26c99d27c99f27c9a027c8a128c8a328c8a429c8a529c8a629c8a82ac8a92ac7aa2bc7ac2bc7ad2cc7ae2dc6af2dc6b12ec6b22ec6b32fc5b430c5b530c4b731c4b832c4b933c3ba33c3bb34c2bc35c2be36c1bf37c1c037c0c138c0c239bfc33abfc43bbec53cbdc63dbdc73ebcc83fbcc940bbca41bacb42bacc43b9cd44b8ce45b8cf46b7d047b7d148b6d249b5d34ab5d44bb4d54cb3d64db3d74eb2d74fb1d851b1d952b0da53afdb54afdb55aedc56aedd58adde59acde5aacdf5babe05cabe05eaae15faae260a9e261a9e363a8e364a8e465a7e566a7e567a6e669a6e66aa5e76ba5e76ca5e86ea4e86fa4e970a3e972a3ea73a3ea74a3eb75a2eb77a2ec78a2ec79a1ec7aa1ed7ca1ed7da1ee7ea1ee7fa1ee81a0ef82a0ef83a0f084a0f086a0f087a0f188a0f189a0f18ba0f28ca0f28da0f28fa0f390a0f391a0f392a0f494a0f495a0f496a0f597a0f599a0f59aa0f59ba0f69ca0f69ea1f69fa1f6a0a1f7a1a1f7a3a1f7a4a1f8a5a1f8a6a2f8a8a2f8a9a2f9aaa2f9aba2f9aca3f9aea3faafa3fab0a3fab1a4fab3a4fab4a4fbb5a4fbb6a5fbb8a5fbb9a5fbbaa6fcbba6fcbda6",
"extensions": {
"https://matplotlib.org/viscm": {
"min_Jp": 15.0,
"max_Jp": 85.0,
"xp": [
-6.837368812602875,
7.257063886481006,
32.857155931755756,
45.801022696220514,
11.85932762495736
],
"yp": [
-13.51483510951951,
-43.14190792596109,
-29.335116710532006,
-4.310307632566776,
10.071766550171873
],
"fixed": -1,
"filter_k": 100,
"cmtype": "linear",
"uniform_colorspace": "CAM02-UCS",
"spline_method": "Bezier"
}
}
}
Binary file added cmasher/colormaps/bubblegum/bubblegum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4770ca1

Please sign in to comment.