# This program expects the data to be in the file "data.kory". # There should be 168 values (7 days x 24 hours). # The data to be plotted are in the third column, # so first we want to extract the third column: awk '{print $3}' < data.kory > data # Now we prepare the "time" values echo "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24" > t cat t t t t t t t > tt # Now we make a Postscript picture using the program xpplot # version 2.2.8 or later is needed # http://staff.vscht.cz/mat/Pavel.Pokorny/xpplot/xpplot.c # to compile it, type cc -o xpplot xpplot.c -lm -lX11 xpplot -b -f"tmp1.ps" -l 0 \ -t"Idaho State University Remote Access Traffic" tt data # Now we prepare the Postscript code for changing colors echo " % 1.2 setlinewidth /C1 {1 0 0 setrgbcolor} bind def % red /C2 {0 0.9 0 setrgbcolor} bind def % green /C3 {0 0 1 setrgbcolor} bind def % blue /C4 {0.7 0.7 0 setrgbcolor} bind def % red+green=yellow or brown /C5 {1 0 1 setrgbcolor} bind def % red+blue=pink /C6 {0 0.8 0.8 setrgbcolor} bind def % green+blue=cyan /C7 {0 0 0 setrgbcolor} bind def % black " > defcolors # Now we use the editor sed to change the x-axis decoration sed '/% Here begins the X-axis/,/% Here begins the Y-axis/ c\ % Here begins the X-axis decoration\ \ 0.23 0.117 0.23 0.133 L\ 0.20 0.078 ( 0am) SH\ 0.26 0.125 0.26 0.133 L\ 0.29 0.125 0.29 0.133 L\ 0.32 0.125 0.32 0.133 L\ 0.35 0.125 0.35 0.133 L\ 0.38 0.125 0.38 0.133 L\ 0.41 0.117 0.41 0.133 L\ 0.38 0.078 ( 6am) SH\ 0.44 0.125 0.44 0.133 L\ 0.47 0.125 0.47 0.133 L\ 0.50 0.125 0.50 0.133 L\ 0.53 0.125 0.53 0.133 L\ 0.56 0.125 0.56 0.133 L\ 0.59 0.117 0.59 0.133 L\ 0.56 0.078 (12am) SH\ 0.62 0.125 0.62 0.133 L\ 0.65 0.125 0.65 0.133 L\ 0.68 0.125 0.68 0.133 L\ 0.71 0.125 0.71 0.133 L\ 0.74 0.125 0.74 0.133 L\ 0.77 0.117 0.77 0.133 L\ 0.74 0.078 ( 6pm) SH\ 0.80 0.125 0.80 0.133 L\ 0.83 0.125 0.83 0.133 L\ 0.86 0.125 0.86 0.133 L\ 0.89 0.125 0.89 0.133 L\ 0.92 0.117 0.92 0.133 L\ 0.89 0.078 (11pm) SH\ \ % Here begins the Y-axis decoration ' < tmp1.ps > tmp2.ps # Now we make the picture larger and landscape cp tmp2.ps tmp3.ps cp tmp2.ps tmp4.ps # sed '/size_x 170 mm def/ c\ # /size_x 258 mm def' < tmp2.ps > tmp3.ps # sed '/angle 0 def/ c\ # /angle 90 def' < tmp3.ps > tmp4.ps # Now we split the Postscript file into 9 files, tmp.0 ... tmp.8 # 1 head, 7 data files for each day, and 1 tail sed '/% Here begin the data/ q' < tmp4.ps > tmp.0 sed -n '/% Here begin the data/,$ p' < tmp4.ps | sed -n '3,$p' > tmp sed -n '001,024p' < tmp > tmp.1 sed -n '025,048p' < tmp > tmp.2 sed -n '049,072p' < tmp > tmp.3 sed -n '073,096p' < tmp > tmp.4 sed -n '097,120p' < tmp > tmp.5 sed -n '121,144p' < tmp > tmp.6 sed -n '145,168p' < tmp > tmp.7 sed -n '169,$ p' < tmp > tmp.8 # Now we change the Postscript code to draw 7 types of lines sed '1 s/P/M SD0 C1/' < tmp.1 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l1 sed '1 s/P/M SD1 C2/' < tmp.2 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l2 sed '1 s/P/M SD2 C3/' < tmp.3 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l3 sed '1 s/P/M SD3 C4/' < tmp.4 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l4 sed '1 s/P/M SD4 C5/' < tmp.5 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l5 sed '1 s/P/M SD5 C6/' < tmp.6 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l6 sed '1 s/P/M SD6 C7/' < tmp.7 | sed 's/P/LT/' | sed '24 s/LT/LT stroke/' > l7 # Now we prepare the Postscript code to make 7 types of marks sed 's/P/C1 SN/' < tmp.1 > p1 sed 's/P/C2 UN/' < tmp.2 > p2 sed 's/P/C3 SL/' < tmp.3 > p3 sed 's/P/C4 T /' < tmp.4 > p4 sed 's/P/C5 FT/' < tmp.5 > p5 sed 's/P/C6 D /' < tmp.6 > p6 sed 's/P/C7 C /' < tmp.7 > p7 # This is xpplot function to draw solid line echo SD0 > SD0 # Now we prepare the legend for the picture echo " % Here begins the legend /x 0.37 def /y 0.82 def /dx 0.05 def /dy 0.05 def /ddy 0.01 def /x1 x dx add def /x2 x1 dx add def newpath C1 x y x1 y SD0 L SD0 x y SN x1 y SN x1 y ddy sub ( Sun) SH /y y dy sub def C2 x y x1 y SD1 L SD0 x y UN x1 y UN x1 y ddy sub ( Mon) SH /y y dy sub def C3 x y x1 y SD2 L SD0 x y SL x1 y SL x1 y ddy sub ( Tue) SH /y y dy sub def C4 x y x1 y SD3 L SD0 x y T x1 y T x1 y ddy sub ( Wed) SH /y y dy sub def C5 x y x1 y SD4 L SD0 x y FT x1 y FT x1 y ddy sub ( Thu) SH /y y dy sub def C6 x y x1 y SD5 L SD0 x y D x1 y D x1 y ddy sub ( Fri) SH /y y dy sub def C7 x y x1 y SD6 L SD0 x y C x1 y C x1 y ddy sub ( Sat) SH /y y dy sub def " > legend # Now we put everything together into the final file picture.ps cat tmp.0 defcolors legend l1 l2 l3 l4 l5 l6 l7 \ SD0 p1 p2 p3 p4 p5 p6 p7 tmp.8 > picture.ps # Now we remove temporary files rm t tt data tmp1.ps tmp2.ps tmp3.ps tmp tmp4.ps defcolors rm legend tmp.0 tmp.1 tmp.2 tmp.3 tmp.4 tmp.5 tmp.6 tmp.7 tmp.8 SD0 rm l1 l2 l3 l4 l5 l6 l7 rm p1 p2 p3 p4 p5 p6 p7 # We can see the result picture.ps using the program Ghostscript gs picture.ps # Good luck # Fri Sep 5 18:28:15 METDST 1997 # Wed Sep 10 12:31:19 METDST 1997 color added # Pavel.Pokorny@vscht.cz