[rrd-users] plot positive and negative in different colours

Dave Holland dh3 at sanger.ac.uk
Tue Oct 31 10:39:03 MET 2006


I have a data value which can be positive or negative. I'm trying to
figure out how to make rrd plot graphs with the line one colour for
positive data, and a different colour for negative data.

So far I have this:

  rrdtool graph out.png DEF:x=foo.rrd:data:LAST CDEF:n=x,DUP,0,LT,*
  CDEF:p=x,DUP,0,GT,* AREA:n#ff0000 AREA:p#0000ff

which gets me a filled graph; positive in blue, negative in red. OK so
far: http://eyas.biff.org.uk/~dave/test3.png

But I'd like a line graph. If I change AREA to be LINE2 then I get a
weird discontinuity when the data changes sign. See for example
http://eyas.biff.org.uk/~dave/test4.png just before the end of week 41.
There's also the issue of the horizontal line at zero; I can disguise
that with a HRULE but it's a bit ugly.

How can I get a single line plotted which changes colour appropriately?

** Dave Holland ** Systems Support -- Special Projects Team **
** 01223 496923 ** Sanger Institute, Hinxton, Cambridge, UK **

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

More information about the rrd-users mailing list