#!/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_(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 # set label 'last update: ' . strftime("%d.%m.%Y",STATS_max) at graph 0.1, graph 0.9 #input set timefmt "%Y-%m-%d" set datafile missing 'N/A' set datafile separator ',' #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 '#696969' linewidth 0.25 # Def. Major-grid set style line 2 linetype rgb '#C9C9C9' 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':STATS_max + 60*60*24*150] # 150 Tage 'Luft' set xtics '1950-01-01', 60 * 60 * 24 * 365.25 * 5 set xtics nomirror set mxtics 5 # set xlabel 'Date' unset ylabel set y2label 'TRY' #unset format y set format y2 '%.0f' unset ytics set y2tics 1 unset mytics set my2tics 5 # set ytics nomirror set y2tics nomirror # 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 } ## gnuplot for SVG - gnuplot 4.2 / Ubuntu 8.10 if (GPVAL_VERSION >= 5.0) { set term svg size 800,400 font "Arial,16" } else { set term svg size 800,400 font "Arial,12" } 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 plot \ infile \ usi 1:($26) axis x1y2 tit '1 EUR in TRY' lt rgb 'blue' lw 1,\ infile \ usi 1:($25/1000000) axis x1y2 tit '1 EUR in 1 000 000 TRL' lt rgb 'dark-violet' lw 1,\