Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2513

plot from many files, with different options

Newsgroups comp.graphics.apps.gnuplot
Date 2014-07-13 04:53 -0700
Message-ID <eb75ec33-05bb-4315-9855-8fcd19909fd8@googlegroups.com> (permalink)
Subject plot from many files, with different options
From Björn Lundin <b.f.lundin@gmail.com>

Show all headers | View raw


Hi!
I'm new to the group, so please have patience ...

I'm on debian with gnuplot 4.6 patchlevel 0
I'd like to plot a 2d diagram with the moving odds of a horse race.

so I got say 15 files with data like this 

2014-07-11 21:17:00.744 | 1.114559180 |  6692779 | 5.10 
2014-07-11 21:17:00.832 | 1.114559180 |  6692779 | 5.10 
2014-07-11 21:17:00.912 | 1.114559180 |  6692779 | 4.10 
2014-07-11 21:17:00.992 | 1.114559180 |  6692779 | 4.10 
2014-07-11 21:17:01.080 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.160 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.232 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.320 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.408 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.488 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.648 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.744 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.832 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:01.912 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:02.040 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:02.152 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:02.264 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:02.368 | 1.114559180 |  6692779 | 3.00 
2014-07-11 21:17:02.576 | 1.114559180 |  6692779 | 3.05 
2014-07-11 21:17:02.672 | 1.114559180 |  6692779 | 3.05 

ie timestamp |raceid|runnerid| odds


the files are called raceid_runnerid_placement.dat
where placement might be 'ww', 'wp', 'lo'
depending if they won (ww) thay were placed (wp) or they
are losers (lo)

so above file is called 1.114559180_6692779_wp.dat
since it came 3rd (3 to be placed)

now, I know I can plot all files like

export MARKETID="1.114559180"
export TARGET_PNG=${MARKETID}".png"
export WINNER="1.114559180_7256679_ww.dat"
export PLACED="1.114559180_7259549_wp.dat 1.114559180_6692779_wp.dat"
export LOSERS="1.114559180_5596467_lo.dat 1.114559180_7267929_lo.dat \
1.114559180_7539753_lo.dat 1.114559180_7554251_lo.dat \
1.114559180_7222723_re.dat 1.114559180_7269234_lo.dat \
1.114559180_7627274_lo.dat 1.114559180_7272303_re.dat \
1.114559180_7542180_re.dat 1.114559180_7302352_lo.dat \
1.114559180_7546026_re.dat 1.114559180_8255417_lo.dat \
1.114559180_7262339_re.dat 1.114559180_7440423_lo.dat \
1.114559180_7547998_lo.dat 1.114559180_8298446_lo.dat"


export RUNNERS="${WINNER} ${PLACED} ${LOSERS}"

gnuplot \
-e "db_name='${DBNAME}'" \
-e "target_png='${TARGET_PNG}'" \
-e "marketid='${MARKETID}'" \
-e "runners='${RUNNERS}'" \
  ../back_prices_during_race2.gpl

where back_prices_during_race2.gpl
contains 


plot for [r in runners] r using 1:4 with lines title r
That will get me different colored lines of each runner.


However i'd like to pass in 
a list of winners (well with 1 item)
a list of placed
a list of losers 

and call gnuplot with

gnuplot \
-e "db_name='${DBNAME}'" \
-e "target_png='${TARGET_PNG}'" \
-e "marketid='${MARKETID}'" \
-e "winners='${WINNER}'" \
-e "placed='${PLACED}'" \
-e "losers='${LOSERS}'"  ../back_prices_during_race2.gpl

instead, and have the runners in winners to be a green solid line,
the placed runners to be  blue solid lines 
and the losers to be red dashed lines.

So I tried
plot for [w in winners] w using 1:4 with lines linetype 4 linecolor rgb 'green' title "Winner",
     for [p in placed]  p using 1:4 with lines linetype 4 linecolor rgb 'blue' title "Placed", 
     for [l in losers]  l using 1:4 with lines linetype 2 linecolor rgb 'red' title "Loser"

but I get 


plot for [w in winners] w using 1:4 with lines linetype 4 linecolor rgb 'green' title "Winner",
               ^
"../back_prices_during_race2.gpl", line 34: function to plot expected

Any pointers ?


--
/Björn










Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar | Unroll thread


Thread

plot from many files, with different options Björn Lundin <b.f.lundin@gmail.com> - 2014-07-13 04:53 -0700
  Re: plot from many files, with different options Björn Lundin <b.f.lundin@gmail.com> - 2014-07-14 02:46 -0700

csiph-web