2 # Demonstrate features of datastrings patch
3 # Ethan A Merritt <merritt@u.washington.edu>
8 # Illustrate reading plot labels from column head in datafile
10 set title "Auto-labeling plots from text fields in datafile"
11 set label 1 "Generate plot labels from first row in each column"
12 set label 1 at graph 0.02, 0.85 tc lt 3
13 set label 2 "Generate x-axis labels from first column in each row"
14 set label 2 at graph 0.02, 0.80 tc lt 3
15 set style data linespoints
19 set key autotitle columnhead
20 plot 'ctg-y2.dat' using 2:xticlabel(1) index 2, \
23 pause -1 "<cr> to plot again using x2ticlabels"
25 # Illustrate reading xtic axis labels from the datafile
28 set title "Read tic labels from a datafile column\nAn approximation of Hans Olav Eggestad's categoric plot patch\nusing 'using ($0):2:xticlabels(1)' and 'set style fill solid border -1'"
30 set style fill solid 1.000000 border -1
34 set xrange [-0.5:11.5]
40 set key autotitle columnhead
41 plot 'ctg-y2.dat' using ($0-0.2):2 index 0 with boxes title "precipitation 1992-2000", \
42 '' using ($0+0.2):2 index 1 with boxes title " 2000-2001", \
43 '' using ($0):2 index 2 with linespoints lw 3 title "runoff 1992-2000", \
44 '' using ($0):2:xticlabels(1) index 3 with linespoints lw 3 title " 2000-2001"
46 pause -1 "<cr> to plot again using x2ticlabels"
48 set title "Same plot using x2ticlabels also"
50 plot 'ctg-y2.dat' using ($0-0.2):2 index 0 with boxes title "precipitation 1992-2000", \
51 '' using ($0+0.2):2 index 1 with boxes title " 2000-2001", \
52 '' using ($0):2 index 2 with linespoints lw 3 title "runoff 1992-2000", \
53 '' using ($0):2:x2ticlabels(1) index 3 with linespoints lw 3 title " 2000-2001"
55 pause -1 "<cr> to plot same data from table format"
56 set title "Plot from table format (titles taken from column headers)"
58 plot 'table.dat' using ($0-0.2):2 title column(2) with boxes, \
59 '' using ($0+0.2):3 title column(3) with boxes, \
60 '' using ($0):4 title column(4) with linespoints, \
61 '' using ($0):5:xtic(1) title column(5) with linespoints
63 pause -1 "<cr> to show double use of y values"
65 set title "Plot actual y-value as a label"
66 plot 'table.dat' using 0:2:xtic(1) title columnhead with boxes, \
67 '' using 0:2:2 with labels center offset 0,1 notitle
69 pause -1 "<cr> continue"
71 # Now show the plot with labels options
75 set title "Read labels from a datafile column\nHere the 'plot with labels' command generates a\nC-alpha trace of retro-GCN4 peptide"
84 plot 'labelplot.pdb' using 7:9 with lines notitle, \
85 '' using 7:9:4 with labels tc lt 3 font "Helvetica,10" notitle
86 # '' using 7:9 with points notitle ps 5 lt -1
88 pause -1 "<cr> to try a 3D version using splot"
92 set title "3D version generated by splot\n(sorry, the axis scales are distorted)"
95 set view 70,210, 1.0,1.7
98 splot 'labelplot.pdb' using 7:8:9 with lines notitle, \
99 '' using 7:8:9:4 with labels left offset 1,0 point \
100 ps 2 pt 1 tc lt 3 font "Helvetica,10" notitle
102 pause -1 "<cr> to view star map"
107 pause -1 "<cr> to end demo"