Skip to main content

Plotting tools for complex-valued functions

Project description

cplot

Plotting complex-valued functions.

CircleCI codecov PyPi Version GitHub stars

cplot is an attempt at encoding complex-valued data in colors. The general idea is to map the absolute value to lightness and the complex argument (the "angle") to the chroma of the representing color. This follows the domain coloring approach with the colors taken from the CAM16 to avoid perceptual distortion. (It has been claimed that this leads to drab images, but the examples below prove the contrary.)

The representation is chosen such that

  • values around 0 are black,
  • values around infinity are white,
  • values around +1 are teal,
  • values around -1 are orange-red,
  • values around +i are purple, and
  • values around -i are yellow-green.

With this, it is easy to see where a function has very small and very large values, and the multiplicty of zeros and poles is instantly identified by counting the color wheel passes around a black or white point.

See below for examples with some well-known functions.

import cplot
import numpy

cplot.show(numpy.tan, -5, +5, -5, +5, 100, 100)

# There is a tripcolor function as well for triangulated 2D domains
# cplot.tripcolor(triang, z)

| | :-------------------:|:------------------:|:----------:| z**1 | z**2 | z**3 |

| | | :-------------------:|:------------------:|:----------:| 1/z | z / abs(z) | (z+1) / (z-1) |

| | :-------------------:|:------------------:|:-------------------------:| numpy.sqrt | numpy.log | numpy.exp |

| | :-------------------:|:------------------:|:-------------------------:| numpy.sin | numpy.cos | numpy.tan |

| | :-------------------:|:------------------:|:-------------------------:| scipy.special.gamma | scipy.special.digamma | mpmath.zeta |

Testing

To run the cplot unit tests, check out this repository and type

pytest

Distribution

To create a new release

  1. bump the __version__ number,

  2. tag and upload to PyPi:

    make publish
    

License

cplot is published under the MIT license.

Project details


Download files

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

Source Distribution

cplot-0.1.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

cplot-0.1.1-py2.py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page