Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help fine tuning: timestamp, average lines with label value, and clean ps file

44 views
Skip to first unread message

hayes...@gmail.com

unread,
Jul 26, 2012, 9:49:15 PM7/26/12
to
Hello all:

I am in the process of fine tuning a script for some runs that I'll be automating for a process and I want to get all the bells and whistles sorted out first. The remaining things I am trying to do are:

[1] Add a single timestamp of the run at the bottom of the figure (not each plot).
[2] Add an average line with a label showing the value above it on the far right for each multiplot.
[3] Make a nice ps figure (portrait and letter size)

I am struggling to sort out the single timestamp and average values with the desired results and I was hoping someone here might be able to point me in the right direction.

Running gnuplot Version 4.6

Any help is greatly appreciated.

Cheers,

t.

#My script
set terminal png size 850,1100 font "Courier New Bold,9"
set out "test.png"
set xrange [0: 30]
set yrange [-2:8]
set ytics -2,2,8
set mytics 2
set mxtics 5
show mytics
show mxtics
set boxwidth 1.0
set style fill solid 0.75 border -1
set key autotitle columnheader
set ylabel "Val"
set multiplot title "Test Run Vals" layout 10,1
plot "tmp.dat" u 1 w boxes lc rgb "blue"
plot "tmp.dat" u 2 w boxes lc rgb "blue"
plot "tmp.dat" u 3 w boxes lc rgb "blue"
plot "tmp.dat" u 4 w boxes lc rgb "blue"
plot "tmp.dat" u 5 w boxes lc rgb "blue"
plot "tmp.dat" u 6 w boxes lc rgb "blue"
plot "tmp.dat" u 7 w boxes lc rgb "blue"
plot "tmp.dat" u 8 w boxes lc rgb "blue"
plot "tmp.dat" u 9 w boxes lc rgb "blue"
plot "tmp.dat" u 10 w boxes lc rgb "blue"
unset multiplot



#My data "tmp.dat"
run1-1 run2-1 run3-1 run4-1 run5-1 run6-1 run7-1 run8-1 run9-1 run10-1
2.23121 0.692520 2.97295 7.46554 1.92200 1.18934 2.16079 1.99373 1.26127 2.90008
1.43531 -0.0671404 2.41960 3.11915 1.36596 1.09575 1.47842 1.47732 0.489480 1.77002
0.691254 -0.634804 1.79327 1.96501 1.12591 0.573254 1.30885 1.39239 -0.223899 1.12855
0.110204 -1.27256 1.07907 1.00449 0.890279 0.303071 0.927053 1.52587 -0.525878 0.238711
0.182633 -0.919170 1.08754 0.926561 0.653640 -0.00836716 1.61319 1.36189 -0.0255389 0.335075
-0.0287705 -1.21623 0.871335 0.935076 0.629302 -0.126145 1.45047 1.48436 -0.248791 -0.115640
-0.0449627 -1.33563 0.948036 0.223273 0.108994 0.440784 0.786519 0.919058 -0.270668 -0.524253
-0.362879 -1.23935 0.634831 0.500511 -0.301901 0.0724473 0.319331 0.128231 -0.359148 -0.723784
0.0332042 -0.633586 0.528332 0.905998 0.198251 0.282872 0.187993 -0.0581472 0.113057 -0.616760
-0.525849 -0.985639 -0.137385 0.307951 -0.105114 0.0897925 0.0558723 -0.484244 -0.584464 -1.04141
-0.408629 -0.723662 0.0486539 0.293584 -0.0439597 -0.366171 0.653207 0.140695 -0.347400 -0.569855
-0.702503 -1.04354 0.0652507 0.0740624 -0.0209640 -0.448421 0.393405 0.271197 -0.249781 -0.772541
-0.355707 -0.704835 -0.187947 0.00788111 -0.109503 -0.862374 1.01357 0.414614 -0.615442 -0.423964
-0.203397 -0.564544 -0.145215 0.310775 -0.509489 -0.387236 0.615358 0.216343 -0.399801 -0.544877
-0.0187958 -0.305046 0.106976 0.0549934 -0.772001 -0.0993505 0.888085 0.193353 -0.0498955 -0.376538
-0.645482 -1.04365 -0.110595 -1.04820 -0.609215 -0.653307 0.488329 0.220708 -0.673529 -0.659817
0.0290333 -0.330772 0.414981 -0.0675902 -0.315040 -0.624999 0.940800 0.420511 0.00300138 0.0671852
0.338007 -0.434996 0.537585 -0.0989809 -0.951215 -0.528442 1.58346 1.48335 -0.0876399 0.166104
0.478275 -0.429098 0.753318 -0.206232 -0.791444 -1.16068 1.75862 1.44257 -0.00674945 0.539419
0.0211707 -1.00911 0.457784 -0.218475 -0.197396 -1.35801 1.26960 1.07152 -0.582135 0.181763
-0.0601281 -0.587021 0.232159 -0.473003 0.215294 -1.68776 1.03415 1.17244 -0.287398 0.397828
-0.589438 -1.03429 -0.111288 -0.932091 -0.116291 -1.66930 0.481340 1.25190 -0.786660 0.0404426
-0.429272 -0.788814 0.0957481 -0.223281 -0.176948 -1.43411 0.531456 0.748928 -0.476462 0.223963
-0.123104 -0.307026 0.151357 -0.361938 0.498754 -1.54713 0.744990 1.26501 -0.331617 0.566046
-0.254786 -0.196236 0.0249553 -0.537196 0.801796 -1.39775 0.144700 0.389309 -0.266773 0.458060
-0.0986873 -0.200745 -0.299476 -0.674539 0.620755 -1.33069 0.111013 0.130390 0.125831 0.194225
0.0341536 -0.124895 -0.0833543 -0.0808987 0.703893 -0.975004 0.463402 0.645091 -0.0165352 0.566505
0.444351 -0.0479081 0.440414 0.0151767 1.10372 0.440128 -0.0430511 0.399079 0.0588099 0.254335
0.789912 0.611289 0.716270 -0.129514 1.28603 0.407692 0.0788459 0.669275 0.692445 0.632002
0.530744 0.0265896 0.597652 0.167161 1.36788 -0.510956 0.512958 0.771034 -0.0102352 0.783998
0.352547 -0.268514 0.632560 -0.281668 1.59248 -0.597141 0.798093 0.659454 -0.0855551 1.04201

hayes...@gmail.com

unread,
Jul 29, 2012, 12:10:41 PM7/29/12
to
So, I managed to figure out a couple of things, namely the average line and label for it (I put it in the title so it would be readable). However, the timestamp still eludes me, as well as a sensible size for the eps out put. Here is the modified script.

Any thoughts on how to get a properly sized EPS figure (ultimately, I'll wind up calling epstopdf to convert to a PDF file).

# New script
set terminal png size 850,1100 font "Courier New Bold,9"
set out "test2.png"
set xrange [0: 30]
set yrange [-2:8]
set ytics -2,2,8
set mytics 2
set mxtics 5
show mytics
show mxtics
set boxwidth 1.0
set style fill solid 0.75 border -1
set key autotitle columnheader
set ylabel "Val"
set multiplot title "Test Run 2 Vals" layout 10,1
stats "tmp.dat" u 1 nooutput
plot "tmp.dat" u 1 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean val: %g", STATS_mean )
stats "tmp.dat" u 2 nooutput
plot "tmp.dat" u 2 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 3 nooutput
plot "tmp.dat" u 3 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 4 nooutput
plot "tmp.dat" u 4 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 5 nooutput
plot "tmp.dat" u 5 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 6 nooutput
plot "tmp.dat" u 6 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 7 nooutput
plot "tmp.dat" u 7 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 8 nooutput
plot "tmp.dat" u 8 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 9 nooutput
plot "tmp.dat" u 9 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
stats "tmp.dat" u 10 nooutput
plot "tmp.dat" u 10 w boxes lc rgb "blue",\
STATS_mean w lines lc rgb "red" title gprintf("Mean Val: %g", STATS_mean )
unset multiplot

Alex van der Spek

unread,
Jul 29, 2012, 3:11:27 PM7/29/12
to
Try using

set timestamp bottom rotate font "Courier, 8"

or something like that just before your last plot. This puts a timestamp in
the margin.

Also try to use a for loop for brevity:
"""

plot for [n=1:9] "tmp.dat" using n with boxes lc rgb "blue"
set timestamp bottom rotate font "Courier, 8"
plot "tmp.dat" using 10 with boxes lc rgb "blue"

"""

Good luck,
Alex van der Spek




<hayes...@gmail.com> wrote in message
news:42ebd976-0d29-469b...@googlegroups.com...
0 new messages