Browse Source

Filenames for gnuplot via env-vars

To not have hardcoded filenames in gnuplot script

https://wiki.ubuntuusers.de/Gnuplot/#Stapelverarbeitung-Zugriff-auf-Umgebungsvariablen
develop
Jonathan Golder 6 years ago
parent
commit
111fc38881
  1. 6
      euroexange/euroexange.py
  2. 10
      gnuplot_scripts/Euro_exchange_rate_to_TRY_-_Turkish_Currency_and_Debt_Crisis_2018.plt

6
euroexange/euroexange.py

@ -213,7 +213,11 @@ class EuroExangeBot( pywikibot.bot.BaseBot ):
os.path.join( type(self).gnuplot_script_dir, os.path.join( type(self).gnuplot_script_dir,
job.script + ".plt" ) ) ) 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): def main(*args):

10
gnuplot_scripts/Euro_exchange_rate_to_TRY_-_Turkish_Currency_and_Debt_Crisis_2018.plt

@ -3,9 +3,11 @@
# gnuplot script for plotting eurofxref-hist.csv as obtained from # gnuplot script for plotting eurofxref-hist.csv as obtained from
# http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html # 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) # 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 ' -----Stats-(Timestamp)----'
print ' Start: ', strftime("%d. %B %Y",STATS_min) print ' Start: ', strftime("%d. %B %Y",STATS_min)
print ' Ende: ', strftime("%d. %B %Y",STATS_max) 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 ## gnuplot for SVG - gnuplot 4.2 / Ubuntu 8.10
set term svg size 800,400 font "Arial,16" 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 set style line 1 lt rgb 'blue' lw 1
#available currencies: #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 #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 \ plot \
'eurofxref-hist.csv' \ infile \
usi 1:($26) axis x1y1 tit '1 EUR in TRY' lt rgb 'blue' lw 1,\ 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 \ usi 1:($26) axis x1y1 notit w p lc rgb 'black' lt 1 lw 1.5 pt 7 ps 0.1 \

Loading…
Cancel
Save