File: colorpts.awk

package info (click to toggle)
gnuplot5 5.0.0~rc%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,548 kB
  • ctags: 8,104
  • sloc: ansic: 77,108; cpp: 6,848; makefile: 1,932; sh: 1,343; lisp: 657; perl: 302; awk: 235; pascal: 194; tcl: 88; python: 46
file content (29 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Script for transforming points (x y z) into "rectangular surface".
# Can be used to draw colour points in gnuplot with the pm3d enhancement
# Petr Mikulik, 14. 10. 1999

BEGIN {
if (ARGC<4) {
  print "Syntax:  awk -f colorpts.awk file dx dy" >"/dev/stderr"
  print "\nWhere 2*dx, 2*dy defines the point size (enlargement) in x, y" >"/dev/stderr"
  print "Gnuplot usage: set pm3d map; splot '<awk -f colorpts.awk pts.dat 0.01 0.01'" >"/dev/stderr"
  exit
}
dx = ARGV[2]
dy = ARGV[3]
ARGC = 2
}

# skip blank lines
NF==0 { next }

# main
{
x=$1; y=$2
print x-dx "\t" y-dy "\t" $3
print x-dx "\t" y+dy "\t" $3
printf "\n" # blank line (new scan)
print x+dx "\t" y-dy "\t" $3
print x+dx "\t" y+dy "\t" $3
printf "\n\n" # two blank lines (new surface)
}