[Interest] Plotting 2d line with color depending on value (like colormap)

Uwe Rathmann Uwe.Rathmann at tigertal.de
Thu Jun 21 13:07:22 CEST 2018


On Thu, 21 Jun 2018 11:51:59 +0200, Massimiliano Maini wrote:

> I'd need to do something like this: https://imgur.com/MLAEuad
> 
> I have a set of (x,y,z) data points and want to plot them on a usual 2d
> plot ( x and y values), but with the line color depending on the z
> values (colormap).

Qwt ( http://qwt.sourceforge.net ) offers something like that:
See http://qwt.sourceforge.net/class_qwt_plot_spectro_curve.html

It is not exactly your requirement as this item renders dots, but it can 
easily be expanded to draw lines with gradients, built from the colors 
that corresponds to the z values.

Actually your type of representation could be added to Qwt - even if I 
never heard of a use case, where interpolating the color on a line 
between 2 samples makes much sense from the user point of view.

But anyway - if you like to go into this direction let me know.

Uwe





More information about the Interest mailing list