[racket-dev] New plot library pushed

From: Neil Toronto (neil.toronto at gmail.com)
Date: Wed Oct 5 13:43:18 EDT 2011

There aren't any porting docs, and that would be really helpful. So yes, 
please!

These 'plot' doc pages are finished:
  - PLoT: Graph Plotting (main page)
  - Introduction
  - 2D Plot Procedures
  - 3D Plot Procedures
  - Compatibility Module

Reading over the finished pages should help you a lot.

These have contracts and examples:
  - 2D Renderers
  - 3D Renderers

These have only contracts (and occasional text and examples):
  - Plot Utilities
  - Plot and Renderer Parameters
  - Plot Contracts

FWIW, the contracts are a little wonky right now. I have a macro that 
generates defprocs and such. Apparently, a recent change to Scribble (or 
elsewhere) loses source location info, so they're badly formatted. Eli 
and I are working on it.

For porting, there are two choices. One is to change (require plot) to 
(require plot/compat). I think that's covered pretty well in the docs 
already.

The other is to keep (require plot). In that case, there are two main 
things to do:
  - Change functions that return renderers:
      mix -> list
      line -> function, parametric or polar
      contour -> contours
      shade -> contour-intervals
      surface -> surface3d
  - Make sure plots have specified bounds

The old plot would let you leave bounds out, and in that case they were 
[-5,5]. That can't consistently work with the new behavior, which is to 
have renderers communicate their bounds to 'plot' or 'plot3d'. So the 
default is now "no bounds".

Here's an example: change

   (plot (line sqr))

to

   (plot (function sqr -5 5))

or

   (plot (function sqr) #:x-min -5 #:x-max 5)

I think that's enough to get started.

Thanks!

Neil T

On 10/05/2011 10:54 AM, Robby Findler wrote:
> Thanks, Neil!
>
> Is there some docs to help people port?
>
> If not, would it be helpful for me to read over the plot and
> plot/compat library and try to put such docs together?
>
> Robby
>
> On Wed, Oct 5, 2011 at 11:45 AM, Neil Toronto<neil.toronto at gmail.com>  wrote:
>> I've just pushed the new 'plot' library.
>>
>> Eli and I both forgot that the new 'plot' still needs the old libfit, and
>> removed it along with libplplot. I just added libfit back (the sources are
>> in "src/fit" now instead of "src/plot/fit") along with the proper configure,
>> Makefile.in, and get-libs.rkt changes.
>>
>> I can verify that libfit compiles on 64-bit Ubuntu. It *should* build on
>> Windows and Mac. :D
>>
>> I've taken Matthew's suggestion to make the new 'plot' as
>> backward-compatible as possible. Plots might still break (such as the
>> example at racket-lang.org and on the Wikipedia page). Using the
>> 'plot/compat' module should make these work.
>>
>> This change replaces about 20000 lines of C+support code with 7000 lines of
>> Racket that does a lot more. Racket code for backward compatibility totals
>> only 500 lines. The libfit library is about 500 lines of C+make code.
>>
>> Neil T
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://lists.racket-lang.org/listinfo/dev
>>



Posted on the dev mailing list.