[racket-dev] New plot library pushed

From: Neil Toronto (neil.toronto at gmail.com)
Date: Sun Oct 9 16:27:57 EDT 2011

That was quick!

On 10/09/2011 01:10 PM, Doug Williams wrote:
> I ported all of the science collection graphics to use the new plot
> package. It was relatively painless. Most of the effort was actually in
> improving my graphics using some of the new options - like adding labels
> for legends. Also, there are many places with the old plot package where
> I had to fudge things like #:x-min and #x-max - like #:x-min 0.001
> instead of #:x-min 0.0 - because the graphics package itself was very
> unforgiving of it's internal numeric errors. Neil's seems to be much
> more robust and forgiving.

I'll take credit for half of that. Internally, it treats any NaNs and 
INFs output from user functions as "holes" and handles them in a 
graphics-primitive-specific way. (E.g. polygons with at least one "hole" 
don't get drawn, lines get split.)

The other half of the credit goes to Racket for giving me exact 
rationals to use for plot bounds and other internal quantities. It's 
been really nice to not have to worry about floating-point error.

> [Obviously I still need to do it in some
> cases where there would be contract violations on functions being plotted.]

Are the contract violations because some of PLoT's contracts are a 
little stricter? (I'm thinking specifically of 'points'.)

> Neil, thanks for the good work.

You're very welcome.

Did you find the "Porting" page helpful?

Neil T


Posted on the dev mailing list.