-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.sh
More file actions
executable file
·24 lines (24 loc) · 804 Bytes
/
draw.sh
File metadata and controls
executable file
·24 lines (24 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#When using the -n2 option, neato ignores any kind of scales (-s or inputscale parameter).
#The following awk script essentially scale the points.
#usage ./draw.sh <scale> <output_format>
#<scale> the scale of the whole picture.
#<output_format> the output format of the resulting picture (e.g. pdf, svg, png). Check neato's manual page for more options.
SCALE=${1:-128}
OUTPUT=${2:-pdf}
awk -v scale=$SCALE '
match($0,/pos="[^"]*"/){
head = substr($0,0,RSTART-1)
tail = substr($0,RSTART,RLENGTH)
rest = substr($0,RSTART+RLENGTH)
while(match(tail,/[0-9]+\.?[0-9]*/)){
n = substr(tail,RSTART,RLENGTH)
n = n * scale
head = head substr(tail,0,RSTART-1) n
tail = substr(tail,RSTART+RLENGTH)
}
print head tail rest
next
}
{print}
' | neato -n2 -Nxlabel="\N" -Nshape=point -T$OUTPUT