# JohannesBuchner/uncertaincolors

Uncertainty visualisation in maps: Display measurement value and error simultaneously with Python/matplotlib
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
cam-CAM.png
cam-JCh.png
demo_colorspace.png
demo_colorspace_gray.png
demo_observation_RdBu.png
demo_observation_cool.png
demo_observation_coolwarm.png
demo_observation_error.png
demo_observation_plasma.png
demo_observation_spring.png
demo_observation_summer.png
demo_observation_value.png
demo_observation_viridis.png
demo_observation_winter.png
test.py
testcam.py
testcmaps.py
testlab.py
testluma.py
uncertaincolors.py

## Maps with Measurement Uncertainty

This is an attempt at implementing uncertainty Visualisation with matplotlib. I want to show measured value and uncertainty in the same image, like here:

(their website is informative: http://spatial-analyst.net/wiki/index.php?title=Uncertainty_visualization )

## Examples

Lets say we have this observation:

And the uncertainty increases from center to outside:

Here are some attempts:

1. This whitens with increasing error:

2. Cool color map:

3. This one grays out:

4. With viridis color map:

5. Winter:

6. Some color maps do not work well, like Red-Blue. This is because the middle is too bright.

## Approach

There are two axes: value is mapped to hue/color, and error should modify either lightness or saturation.

Modern colormaps are perceptually uniform. They increase the lightness/luma in lockstep with the color.

Here however we two independent axes, like here:

On the vertical axis are different colors. Towards the right, the image desaturates (with increasing uncertainty).

The nice thing about this approach is that in a black-and-white print-out, only one axis is lost (saturation), but the vertical axis (lightness) still goes with value.

Here is the same image, grayscaled:

## Code

### Why not just map with HSV?

Initially I thought to just go to a colorspace such as JCh or HSV that have color (Hue H) and lightness or saturation as independent axes (V,J). This gives images like this one:

The arcs make the image useless. Colors here are not desaturized homogeneously.

Instead, the approach I chose is to select a colormap and get the initial values (at uncertainty 0) and find their saturation. I normalise the colormaps to the same saturation. The second axis then desaturates until no color is left.

You can’t perform that action at this time.