[racket-dev] Adding the new plot library [was: Re: Plot?]

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed Sep 28 12:01:39 EDT 2011

Eli, I'm moving part of our discussion to the dev list for others' input.

On 09/25/2011 04:39 PM, Eli Barzilay wrote:
> Three hours ago, Neil Toronto wrote:
>> It's going well. We could put it in the repo later today if you
>> want. I just have to consolidate a bunch of parameters first, and
>> move bits of code around to their final resting places.
> That would be wonderful.  Just to clarify, every time I see the C mess
> there I need to throw up, and I think that I'm not the only one.

It's ready now, but I have questions.

The new plot library is actually two modules. The old 'plot' assumed 
that a "plot data" only needed to DRAW in a plot area, so a "plot data" 
is just a lambda that accepts a plot area argument. There's no way for 
the "plot data" to negotiate its drawing bounds, request ticks and tick 
labels, or report the data necessary to assemble a legend.

So I had to redesign it all. In the new plot library, a "renderer" has 
those nifty abilities. The new library has scads of other improvements, 
more plot types, and a richer API. I'll call its main module "Module 1".

"Module 2" is a compatibility module, a thin wrapper around Module 1. 
It's a drop-in replacement for the old 'plot' module.


1. Obviously, Module 2's path should be 'plot'. Right? And its 
documentation needs a note that it's deprecated. (I'll do that.)

2. Should Module 2 send a deprecation warning to stderr or the log when 

3. Should Module 1's path be 'racket/plot'? I've also thought of 
'new-plot' (which is a cute pun on "gnuplot" but inconsistent with other 
names) and 'rackplot' (which is consistent with 'racklog' and 
'rackunit'). Could also go with "omgraph" or whatever. I'm open to 

4. I didn't write a 'plot/extend' replacement because it would have been 
painful and bit convoluted. Also, nearly everything 'plot/extend' 
provides is more easily done using either the old 'plot' or Module 1. As 
of now, it will just quietly disappear. Is that okay?

5. I'll have general questions about how to put things in the collects. 
I could probably answer them all by looking at a GOOD example. What, in 
your opinion, is the archetypal collects library, which would show me 
How It Should Be Done?


Last thing: I haven't replaced the 'fit' function, because it has 
nothing to do with plotting or the plotting C library! I don't know why 
it's in 'plot' in the first place. The C library behind 'fit' will have 
to stay for now, so there will still be a bit of a C mess that makes Eli 
throw up.

I can replace that too - eventually. I think it would be best to 
separate concerns for now.

Neil T

Posted on the dev mailing list.