0

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

user200179
  • 13
  • 3
  • What are you actually asking for? It sounds like something to do with the Y-Axis configuration, maybe the graph upper and lower limits on the Y axis, or the axis labels? It sounds like this is onw time when the RRDTool AI is getting it wrong. You can always override the default Y-axis labelling using --y-grid, or use --alt-y-grid for an alternative algorythm. Also you can use --allow-shrink with the upper-limit and lower-limit though it wouldn't help much here. – Steve Shipway Aug 24 '20 at 05:53

1 Answers1

0

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

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • The code works as you suggested. The y-axis now looks the way I imagined. Many thanks! – user200179 Aug 29 '20 at 17:57
  • @user200179 If this answers your question, then please mark the answer as useful and correct on StackOverflow - it will help future people with a similar question, and will give me more Reputation points :) – Steve Shipway Aug 30 '20 at 19:50