Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

colormap2d

Project Description

This python package provides functionality for 2D colormaps. 2D colormaps can be used to visualise images of two parameters at the same time. Typical examples are: a complex function’s magnitude and argument, windspeed and direction, a signals strength and phase (spectrogram), a signals energy and frequency.

Features

  • a growing set of carefully designed 2D colormaps
  • simple matplotlib style functions to plot data using the 2D colormaps
  • 2D colormap designer based on the 3D animation software blender

Example

import numpy as np
import matplotlib.pyplot as plt
from colormap2d import imshow2d

# complex input data
x = np.linspace(-5, 5, 100)
regrid, imgrid = np.meshgrid(x, x)
zgrid = regrid + 1j * imgrid

complex_function = (zgrid ** 2 - 2.) * (zgrid - 1 - 1j) ** 2 /\
                   (zgrid + 2j) / (zgrid**2 - 5 - 2j)


# assemble [2, nwidth, nheight] array
data = np.array([np.angle(complex_function),
                 np.log(np.abs(complex_function))])

# plot to screen
imshow2d(data, cmap2d='wheel')
plt.show()

simple example

Blender Colormap Designer

The associated blender script allows to generate colormaps in the uniform colorspace CAM02-UCS (thank you colorspacious) by drawing a 3d spline path or a 3d spline surface in blender.

The most common 2D colormap used varies linearly in HSV/HSL colorspace. This colormap is unfortunately not very smooth visually. The following image shows a colormap that has been designed in blender. It starts at white and then goes into the six corners of the CAM02-UCS Gamut.

brightwheel2d

Blender designed colormaps are much smoother than the classical HSV colormap. The following comparison shows a complex polynomial that has poles. HSV is shown in the top row as reference.

poles and zeros function

Click here to see more colormaps in 3d colorspace.

Click here to see how to install and use the script.

Release History

Release History

This version
History Node

0.4

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
colormap2d-0.4.tar.gz (308.1 kB) Copy SHA256 Checksum SHA256 Source Sep 8, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting