Icons are changed
[gnuplot] / demo / datastrings.dem
1 #
2 # Demonstrate features of datastrings patch
3 # Ethan A Merritt <merritt@u.washington.edu>
4 # 08-Mar-2003
5 #
6 reset
7 #
8 # Illustrate reading plot labels from column head in datafile
9 #
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
16 set ylabel "mm"
17 set yrange [0:200]
18 #
19 set key autotitle columnhead
20 plot 'ctg-y2.dat' using 2:xticlabel(1) index 2, \
21      ''           using 2 index 3 
22 #
23 pause -1 "<cr> to plot again using x2ticlabels"
24 #
25 # Illustrate reading xtic axis labels from the datafile
26 #
27 reset
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'"
29 set boxwidth 0.3
30 set style fill solid 1.000000 border -1
31 set bmargin 3
32 set pointsize 2
33 set yrange [0:180]
34 set xrange [-0.5:11.5]
35 set ylabel "mm"
36 set tics scale 0.0
37 set grid y
38 set xtics
39 #
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"
45 #
46 pause -1 "<cr> to plot again using x2ticlabels"
47 #
48 set title "Same plot using x2ticlabels also"
49 set x2tics
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"
54 #
55 pause -1 "<cr> to plot same data from table format"
56 set title "Plot from table format (titles taken from column headers)"
57 unset x2tics
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
62 #
63 pause -1 "<cr> to show double use of y values"
64 #
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
68 #
69 pause -1 "<cr> continue"
70 #
71 # Now show the plot with labels options
72 #
73 reset
74
75 set title "Read labels from a datafile column\nHere the 'plot with labels' command generates a\nC-alpha trace of retro-GCN4 peptide"
76 set size square
77 unset xtics
78 unset ytics
79 set border 3
80 set xlabel "X--->"
81 set ylabel "Z--->"
82 set key bottom right
83 #
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 
87 #
88 pause -1 "<cr> to try a 3D version using splot"
89 #
90 reset
91
92 set title "3D version generated by splot\n(sorry, the axis scales are distorted)"
93 set zrange [-15:15]
94
95 set view 70,210, 1.0,1.7
96 set ticslevel 0.0
97
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
101 #
102 pause -1 "<cr> to view star map"
103 #
104 reset
105 load "starmap.dem"
106 #
107 pause -1 "<cr> to end demo"