File Exchange

image thumbnail

Conditionally Colored Plot (CCPLOT)

version 1.1 (1.61 KB) by

Plots conditionally colored (2D line) graphs.



View License

Plots the vector Y versus vector X using conditional coloring based on colormaps.

The condition vector C is independent of the values of X and Y but must be the same size.

The colormap MAP can either be a Matlab or a userdefined colormap.

x = linspace(0,4*pi,50);
y = sin(x);
c = y.^2;
map = colormap(jet);
h = ccplot(x,y,c,map);

Comments and Ratings (2)

minor issue, either the >= or <= on line 32 must have the = removed to avoid omitting segments with endpoints on colormap transition points. See the segment between the 6th and 7th points in the example plot

JR King

Thanks. It would be nice however to allow multiple line plotting such as: ccplot(1:10,rand(200,10),c,map)



* Fixed minor error in example

MATLAB Release
MATLAB 7.11.1 (R2010bSP1)

Inspired by: Conditionally colored line plot

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video