#!/usr/bin/env gnuplot
# based on code of [[User:Gorgo]]/[[:c:File:Euro exchange rate to TRY.svg]]
# 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_TRY_(6000px_wide).svg'
# Start und Ende ermitteln (z.Zt. nur für Consolenausagabe)
statsinfileevery::1u(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
setlabel'last update: '.strftime("%Y-%m-%d",STATS_max)atscreen0.87,screen0.9
#input
settimefmt"%Y-%m-%d"
setdatafilemissing'N/A'
setdatafileseparator','
#output
setkeybottomright
setstyledatalines
setborder11# Rahmen unten (Bit 1) und links (+ Bit 2)
setgrid# Gitterlinien verwenden
# Gitterlinienen per Hand setzen falls gewünscht
setstyleline1linetypergb'#696969'linewidth0.25# Def. Major-grid
setstyleline2linetypergb'#C9C9C9'linewidth0.15# def. Minor-grid
setgridxticsmxtics# eventuell noxtics und nomxtics
setgridyticsmytics# eventuell noytics und nomytics
setgridback# Gitter im Hintergrund
setgridlinestyle1,linestyle2# Setzen des linestyle für Major u. Minor
setxdatatime
setformatx'%Y'
setxrange['1998-12-31':'2018-11-01']
setxrange['1998-12-31':STATS_max+60*60*24*21]# 21 Tage 'Luft'
setxtics'1950-01-01',60*60*24*365.25*1
setxticsnomirror
setmxtics12
#set xlabel 'Date'
setylabel'TRY'
sety2label'TRY'
setformaty'%.0f'
setformaty2'%.0f'
setytics1
sety2tics1
setmytics5
setmy2tics5
# Zebramuster
setstylerectfillcolorlt-1fillstylesolid0.04noborder
dofor[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)
setobjectrectanglefromrec_q1_begin,graph0torec_end,graph1
setobjectrectanglefromrec_q2_begin,graph0torec_end,graph1
setobjectrectanglefromrec_q3_begin,graph0torec_end,graph1
}
## gnuplot for SVG - gnuplot 4.2 / Ubuntu 8.10
if (GPVAL_VERSION>=5.0){
settermsvgsize6000,400font"Arial,16"
}else{
settermsvgsize6000,400font"Arial,12"
}
setoutpoutfile
setstyleline1ltrgb'blue'lw1
#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
plot\
infile\
usi1:($26)axisx1y1tit'1 EUR in TRY'ltrgb'blue'lw1,\
infile\
usi1:($25/1000000)axisx1y1tit'1 EUR in 1 000 000 TRL'ltrgb'dark-violet'lw1,\
infile\
usi1:($26)axisx1y1notitwplcrgb'black'lt1lw1.5pt7ps0.06,\
infile\
usi1:($25/1000000)axisx1y1notitwplcrgb'black'lt1lw1.5pt7ps0.06,\