gnuplot_scripts: Basic version obtained from wiki
Source https://commons.wikimedia.org/w/index.php?title=File:Euro_exchange_rate_to_TRY_-_Turkish_Currency_and_Debt_Crisis_2018.svg&oldid=320846888
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
# 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
|
||||
|
||||
|
||||
# download and unzip data if not available
|
||||
# code only für Unix-Shells sh, bash, ...
|
||||
# remove or comment out these lines in Windows/MacOS. an load fram source manualy
|
||||
#
|
||||
# sh: remove file eurofxref-hist.csv if last zip-file is not from today
|
||||
! [ -f upload-from-$(date '+%Y-%m-%d').zip ] || \
|
||||
remove eurofxref-hist.csv \
|
||||
-O upload-from-$(date '+%Y-%m-%d').zip
|
||||
# sh: get new zip-file from EZB if last zip-file is not from today
|
||||
! [ -f upload-from-$(date '+%Y-%m-%d').zip ] || \
|
||||
wget http://www.ecb.int/stats/eurofxref/eurofxref-hist.zip \
|
||||
-O upload-from-$(date '+%Y-%m-%d').zip
|
||||
# sh: extract zip-file every time
|
||||
! unzip -o upload-from-$(date '+%Y-%m-%d').zip
|
||||
|
||||
|
||||
# Start und Ende ermitteln (z.Zt. nur für Consolenausagabe)
|
||||
stats 'eurofxref-hist.csv' 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 ' --------------------------'
|
||||
set label 'last update: ' . strftime("%Y-%m-%d",STATS_max) at graph 0.05, 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 3 # 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.5 dashtype 0 # Def. Major-grid
|
||||
set style line 2 linetype rgb '#C9C9C9' linewidth 0.5 dashtype 3 # def. Minor-grid
|
||||
#set grid xtics mxtics # eventuell noxtics und nomxtics
|
||||
set grid x2tics
|
||||
set grid ytics mytics # eventuell noytics und nomytics
|
||||
set grid back # Gitter im Hintergrund
|
||||
set grid linestyle 1, linestyle 2 # Setzen des linestyle für Major u. Minor
|
||||
|
||||
# die Kalenderwochen-Markierung machen wir über x2 !!!
|
||||
set xdata time
|
||||
set x2data time
|
||||
set format x '1. %b'
|
||||
set xtics rotate by +15 center offset 0,-0.5
|
||||
set format x2 ''
|
||||
set xrange ['2018-01-01':'2019-01-01']
|
||||
set x2range ['2018-01-01':'2019-01-01']
|
||||
set x2tics '2018-01-01', 60 * 60 * 24 * 7
|
||||
set x2tic scale 0
|
||||
set xtics nomirror
|
||||
unset mxtics
|
||||
set xlabel '2018'
|
||||
|
||||
|
||||
set ylabel 'TRY'
|
||||
# set y2label 'TRY'
|
||||
set format y '%.0f'
|
||||
# set format y2 '%.0f'
|
||||
|
||||
set ytics 1
|
||||
set mytics 5
|
||||
set ytics nomirror
|
||||
|
||||
# Zebramuster
|
||||
set style rect fillcolor lt -1 fillstyle solid 0.06 noborder
|
||||
do for [i=1:12:2] {
|
||||
marker_start=sprintf("2018-%1.2d-01",i)
|
||||
marker_stop =sprintf("2018-%1.2d-01",i+1)
|
||||
print 'setze grauen Marker: ' . marker_start . "-" . marker_stop
|
||||
set object rectangle from marker_start,graph 0 to marker_stop, graph 1
|
||||
}
|
||||
|
||||
## 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 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 \
|
||||
'eurofxref-hist.csv' \
|
||||
usi 1:($26) axis x1y1 tit '1 EUR in TRY' lt rgb 'blue' lw 1,\
|
||||
'eurofxref-hist.csv' \
|
||||
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