# gnuplot script for plotting eurofxref-hist.csv as obtained from
# http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
# Before runnig this script, download and unzip to working directory:
# https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip
infile='eurofxref-hist.csv'
outfile='Euro_exchange_rate_to_GBP' . '_(800px_wide).svg'
# Start und Ende ermitteln (z.Zt. nur für Consolenausagabe)
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)
print ' --------------------------'
# Datum des letzten Updates oben links setzen
#input
set timefmt "%Y-%m-%d"
set datafile missing 'N/A'
set datafile separator ','
stats infile every ::1 using (column("GBP")) name "col_stat" nooutput
print 'Groesster Wert der Spalte GBP ist: ', col_stat_max
print 'Kleinster Wert der Spalte GBP ist: ', col_stat_min
#output
set key bottom right
set style data lines
set border 9 # Rahmen unten (Bit 1) und links (+ Bit 2)
unset grid # Gitterlinien verwenden
# Gitterlinienen per Hand setzen falls gewünscht
set style line 1 linetype rgb '#494949' linewidth 0.25 # Def. Major-grid
set style line 2 linetype rgb '#A9A9A9' linewidth 0.15 # def. Minor-grid
set grid xtics mxtics # eventuell noxtics und nomxtics
set grid y2tics my2tics # eventuell noytics und nomytics
set grid back # Gitter im Hintergrund
set grid linestyle 1, linestyle 2 # Setzen des linestyle für Major u. Minor
set xdata time
set format x '%Y'
set xrange ['1998-12-31':'2019-04-05']
set xtics '1950-01-01', 60 * 60 * 24 * 365.25 * 5
set xtics nomirror
set mxtics 5
# set xlabel 'Date'
# Y-Achse
unset ylabel
# set ytics nomirror
unset ytics
unset mytics
set y2range [ 0 : ]
# unset format y
set y2label 'GBP'
set y2tics nomirror
set y2tics 0.2
set my2tics 5
set y2range [ 0.4 : ]
set format y2 "%.2f"
# Zebramuster
set style rect fillcolor lt -1 fillstyle solid 0.03 noborder
do for [i=1950:2050:1] {
rec_q1_begin =sprintf("%1.4d-04-01",i)
rec_q2_begin =sprintf("%1.4d-07-01",i)
rec_q3_begin =sprintf("%1.4d-10-01",i)
rec_end =sprintf("%1.4d-01-01",i + 1)
set object rectangle from rec_q1_begin,graph 0 to rec_end, graph 1
set object rectangle from rec_q2_begin,graph 0 to rec_end, graph 1
set object rectangle from rec_q3_begin,graph 0 to rec_end, graph 1
}
set term svg size 800,400 font "Arial,16"
set outp outfile
set style line 1 lt rgb 'blue' lw 1
#available currencies:
#first one is $2, second $3 and so on
#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
set arrow from "2016-06-23", graph 0 to "2016-06-23", graph 1 nohead lc rgb "#FF0000" back
set label "Brexit Ref." at "2016-06-23", graph 0.3 rotate by +60 center front
plot \
infile usi 1:(column("GBP")) axis x1y2 tit '1 EUR in GBP' lt rgb 'blue' lw 1,\