graphrrdtool

Can not display values adequately on the y-axis using rrdtool graph


I use rrdtool as a database for weather data. Everything works fine. Only the output of the air average air pressure (measured in hPa) causes problems with the output as a graph. The air pressure usually ranges between minimally 960 hPa and maximally 1050 hPa. With the option ‘--alt-autoscale’, the fluctuations in the air pressure are displayed, but not the values on the y-axis. If I enter 1050 as ‘--upper-limit’ and 950 as ‘--lower-limit’, values between 0.8 k and 1.2 k hPa appear on the y-axis, but the line with the average values corresponds to a parallel to the x-axis (see image). One can also not display values like ‘1000’ on the Y-axis instead of SI units like ‘1.0 k’. Example of the code used for displaying the pressure values:

rrdtool graph /var/www/html/graphs/pres_day.png \
    --end now  --start end-1d \
    --title "Luftdruck (24 Stunden)"  \
    --vertical-label "hPa" \
    --alt-autoscale\
    DEF:pres1=/home/pi/weather/wetterserver/wetter.rrd:pres1:AVERAGE \
    LINE1:pres1#00FF00

Line paralleling x-axis


Solution

  • Try using this:

    rrdtool graph /var/www/html/graphs/pres_day.png \
        --end now  --start end-1d \
        --title "Luftdruck (24 Stunden)"  \
        --vertical-label "hPa" \
        --lower-limit 950 --upper-limit 1050 --allow-shrink \
        --y-grid 5:2 \
        DEF:pres1=/home/pi/weather/wetterserver/wetter.rrd:pres1:AVERAGE \
        LINE1:pres1#00FF00
    

    This will cause grid lines every 5, with a label every 10, and the Y axis will go from 950 to 1050 (or a smaller range if the data are more constant). Consider adjusting or even removing the upper/lower limits, or changing the y-grid values to something such as 5:5 or 10:2

    See here for details on the options https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html