Skip to content

Instantly share code, notes, and snippets.

@stan-janssen
Last active February 1, 2024 09:57
Show Gist options
  • Save stan-janssen/3fe7f68c0352db89b8f25bd650d04d48 to your computer and use it in GitHub Desktop.
Save stan-janssen/3fe7f68c0352db89b8f25bd650d04d48 to your computer and use it in GitHub Desktop.
Klimaatstreepjescode voor De Bilt, Nederland
# Gnuplot script that downloads weather station data
# for a specific station in The Netherlands and draws
# a colored chart based on each year's average temperature.
set datafile separator ','
set term svg size 800,200
set output 'barcode.svg'
# Remove margins
set tmargin 0
set bmargin 0
set lmargin 0
set rmargin 0
# Make the boxes fill the chart
set style fill solid
set yrange [7:13]
# Define the color palette and anchor it to specified temperatures
# https://coolors.co/gradient-maker/0b2d8d-5fa0f0-fffdf5-f66663-9c0303?position=0,20,50,80,100&opacity=100,100,100,100,100&type=linear&rotation=90
set palette model RGB defined (70 "#0B2D8D", 80 "#5FA0F0", 90 "#FFFDE8", 100 "#F66663", 110 "#9C0303")
# Remove decorations
unset xtics
unset ytics
unset key
unset border
unset colorbox
set xrange [1900.5:2023.5]
# Download data and plot the chart
plot '< curl https://cdn.knmi.nl/knmi/map/page/klimatologie/gegevens/maandgegevens/mndgeg_260_tg.txt 2>/dev/null | sed -e "s/ //g" | tail -n +16 | head -n -1' using 2:15:15 with boxes lc palette
@stan-janssen
Copy link
Author

stan-janssen commented Jan 3, 2023

Running this in Gnuplot will result in the following image:

barcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment