Tags

, , , , ,

Let’s look at an example data file first:

+2   +2   10.0
+1   +1    9.0
 0    0    7.8
+1   -1   17.0
+2   -2    1.2

We want to plot the numbers in the third column in the y-axis with (+2,+2), (+1,+1), .., (+2,-2) as the corresponding x-values.

There are two aspects to deal with here, namely
(1) to use strings as (x)tic labels —>  xticlabels function can handle that.
(2) to combine two numbers in two different columns into a single string —> sprintf function can handle that.

Here’s what a sample gnuplot command would look like

gnuplot> plot using ($0):3:xticlabels( sprintf("(%+d,%+d)",$1,$2) ) with linespoints

About these ads