Filenames for gnuplot via env-vars
To not have hardcoded filenames in gnuplot script https://wiki.ubuntuusers.de/Gnuplot/#Stapelverarbeitung-Zugriff-auf-Umgebungsvariablen
This commit is contained in:
@@ -213,7 +213,11 @@ class EuroExangeBot( pywikibot.bot.BaseBot ):
|
||||
os.path.join( type(self).gnuplot_script_dir,
|
||||
job.script + ".plt" ) ) )
|
||||
|
||||
subprocess.call( cmd, cwd=self.wdir )
|
||||
plt_env = os.environ.copy()
|
||||
plt_env["INFILE"] = type(self).csv_file
|
||||
plt_env["OUTFILE"] = job.image
|
||||
|
||||
subprocess.call( cmd, cwd=self.wdir, env=plt_env )
|
||||
|
||||
|
||||
def main(*args):
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
# gnuplot script for plotting eurofxref-hist.csv as obtained from
|
||||
# http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
|
||||
|
||||
infile=system("echo $INFILE")
|
||||
outfile=system("echo $OUTFILE")
|
||||
|
||||
# Start und Ende ermitteln (z.Zt. nur für Consolenausagabe)
|
||||
stats 'eurofxref-hist.csv' every ::1 u (strptime("%Y-%m-%d",strcol(1))) nooutput
|
||||
stats infile every ::1 u (strptime("%Y-%m-%d",strcol(1))) nooutput
|
||||
print ' -----Stats-(Timestamp)----'
|
||||
print ' Start: ', strftime("%d. %B %Y",STATS_min)
|
||||
print ' Ende: ', strftime("%d. %B %Y",STATS_max)
|
||||
@@ -68,7 +70,7 @@ do for [i=1:12:2] {
|
||||
## gnuplot for SVG - gnuplot 4.2 / Ubuntu 8.10
|
||||
set term svg size 800,400 font "Arial,16"
|
||||
|
||||
set outp 'Euro exchange rate to TRY - Turkish Currency and Debt Crisis 2018.svg'
|
||||
set outp outfile
|
||||
set style line 1 lt rgb 'blue' lw 1
|
||||
|
||||
#available currencies:
|
||||
@@ -76,7 +78,7 @@ set style line 1 lt rgb 'blue' lw 1
|
||||
#USD,JPY,BGN,CYP,CZK,DKK,EEK,GBP,HUF,LTL,LVL,MTL,PLN,ROL,RON,SEK,SIT,SKK,CHF,ISK,NOK,HRK,RUB,TRL,TRY,AUD,BRL,CAD,CNY,HKD,IDR,ILS,INR,KRW,MXN,MYR,NZD,PHP,SGD,THB,ZAR
|
||||
|
||||
plot \
|
||||
'eurofxref-hist.csv' \
|
||||
infile \
|
||||
usi 1:($26) axis x1y1 tit '1 EUR in TRY' lt rgb 'blue' lw 1,\
|
||||
'eurofxref-hist.csv' \
|
||||
infile \
|
||||
usi 1:($26) axis x1y1 notit w p lc rgb 'black' lt 1 lw 1.5 pt 7 ps 0.1 \
|
||||
|
||||
Reference in New Issue
Block a user