Dirty hacks

Points with different colors

ctioga is not yet able to handle 3-dimensional sets. But, sometimes, you can emulate a 3D behavior. Here is an example: I was requested to come up with a way to color points of a graph according to a certain column.

The first step to achieve this is to be able to color all points differently. For that, I use a trick based on the 1##10 dataset expansion and some ruby code to turn a single data file into a hundred different sets (as much as there are points), and I use the gradient colorset to color each one differently.

ctioga --xpdf --marker Circle -N \
    --line-style no --marker-scale 0.3 \
    --color-set gradient:Red--Green,100 \
    trig.dat@'$1:if $0 == 0##99; $2; else nan; end'

Then, once this is made, it is easy to select the color according to a different column. There is a version where the color is chosen based on the value of column 3:

ctioga --xpdf -N trig.dat@1:3 --marker Circle \
    --line-style no  --marker-scale 0.3 \
    --color-set gradient:Red--Green,11 \
    trig.dat@'$1:;a = 0##9 * 0.2 - 1; b = $3; if((b>= a) && (b <= a+0.2)); $2; else nan; end'


Please note the ; at the beginning: it prevents ctioga from interpreting a = as a thing of the like of yerr= (for errorbars). Please note that, as of version 1.6, you need to make sure that no set is empty in the end (all sets produced have at least one element). If you fail to do so, ctioga will crash (but I’ll correct that for a later version).