Giter Club home page Giter Club logo

get-cpt's Introduction

get_cpt: a python utility to fetch matplotlib colormaps from .cpt files

main image

The goal: To provide an easy, unified interface to load external and custom colormaps in matplotlib. The focus is on .cpt files, which are a common standard in external colormaps [1] and are frequently featured in colormap repos such as cpt-city [2].

The background: Multiple tools to load .cpt files already exist (e.g. see here: [3],[4],[5]). The most encapsulated effort is pycpt [6], a well-written package that is able to load .cpt files from multiple sources. However, this package was originally made for python 2.x and has certain limitations and, sometimes, added complexity for many user groups.

The functionality:

  • To create a simple, flexible interface where .cpt files can be loaded, building from pycpt.
  • To utilise the robust engine of pycpt for parsing .cpt files, after some tweaks and updates.
  • To allow multiple use cases of easy .cpt file loads from the user (from full paths, from a preset repo, from a url).
  • To control and simplify the complexity matplotlib introduces with its multiple classes of colormaps, but offer added functionality to the user as well, in case he/she wants hex color lists, fewer colors, ListedColormap objects instead of LinearSegmented ones etc.

Requirements:

  • python 3.6 or newer
  • numpy 1.14 or newer
  • matplotlib 2.2.2 or newer

Tested in two environments: (py 3.7|np 1.18.1|mpl 3.1.3) and (py 3.6|np 1.14.2|mpl 2.2.2). Also uses urllib for the url handles.

Howto: Instructions are provided in the relevant Jupyter Notebook tutorial.

Closing remarks:

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.