I did it slightly differently in the end - cron calls a script which pulls the data from rrd then processes it and saves it in a single file that gnuplot can use:
# Fetch daily data from rrds
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_messages-local_accepted.rrd AVERAGE -e midnight today -s end-1day -r 3m -a > /run/messages
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_aircraft-recent.rrd AVERAGE -e midnight today -s end-1day -r 3m -a > /run/aircraft
# Remove headers and extraneous :
sed -i 's/://' /run/messages
sed -i 's/://' /run/aircraft
sed -i -e '1d;2d' /run/messages
sed -i -e '1d;2d' /run/aircraft
# Combine both files to create space separated data file for use by gnuplot
join -o 1.2 2.2 /run/aircraft /run/messages > /var/cache/fetch/$(date -I --date=yesterday)-scatter
This is called a few minutes after midnight and names the file for the previous complete 24 hour day. I set it to use a resolution of 3 minutes, which gives a smaller number of points to plot.
Currently I have a gnuplot script that just generates a graph for the last complete day:
date = system("date -I --date=yesterday")
set terminal pngcairo enhanced size 1280,1024
set output './'.date.'-adsb.png'
set title 'Message rate compared to aircraft seen'
set xlabel 'Aircraft'
set ylabel 'Messages rate /s'
set grid xtics ytics
f(x) = a*x**2 + b*x + c
c = 0
fit f(x) '/var/cache/fetch/'.date.'-scatter' via a,b
plot '/var/cache/fetch/'.date.'-scatter' notitle, f(x) notitle
Running “gnuplot adsb.plot” generates the .png file:
Once I’ve collected a bit more data I’ll add some comparisons to it. I’m not sure a quadratic regression is ideal for this, but it seems to fit the data quite well for an RTL dongle in a busy area. It might not fit as well for an airspy.