gnuplot looks to have just the functionality I need. It's going to be awkward to use from PERL, but not impossible. You feed it a bunch of parameters and data in the stdin and it can spit out a gif file to stdout. It's not pretty, though, so I'm still open to suggestions about an all-PERL solution.