Set trace colors from index wave

A user interface for assigning trace colors from a color table based on some numeric quantity that varies between traces.

The "Make Traces Different" package can color traces so that colors are equally spaced* between the limits of a color table. But if you want to take index values from a wave, or to manually define color index values that vary in some non-linear way, this snippet may help.

* note that "Make Traces Different" selects the row number of a color table wave using round() rather than floor(). For high-resolution color tables the results are similar, but for color tables with visible steps we should use floor() to ensure that colors are indexed quantitatively to a color scale.

Edit: see the 'Color Traces by Index' project for current version of this code.

 

The snippet adds a "Color traces by index" menu item to the graph menu.

To demo the snippet, open ColourTracesByIndex.ipf in Igor, copy the demo() function below into the procedure window, and execute "demo()" in the command window:

function demo()
    int i
    Display
    for (i=0;i<=20;i++)
        Make/O $"foo"+num2str(i)/wave=w
        w = i + i/100*x
        AppendToGraph w
    endfor
    CTtraces#MakePanel()
end

 

After some requests for additional features I added a bit more to this code. The extra stuff takes it a bit beyond the 'code snippet' size, so I will create a new project for it.

The project can be found here.

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More