[racket] Plot to png

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jan 17 08:20:41 EST 2011

Contrary to the docs, a plot-view inherits from image-snip, which means you should be able to get the bitmap and from there you should be able to write things to a file. (See below.) 

But this is clearly an oversight and calls for an extension. Then again, perhaps I am overlooking things -- Matthias

> #lang racket/gui
> (require plot)
> (define id:plot (plot (line (lambda (x) x))))
> (is-a? id:plot image-snip%)
> (define id:bitmap (send id:plot get-bitmap)) 
> (send id:bitmap save-file "test.png" 'png)

On Jan 17, 2011, at 7:18 AM, Milan Markovic wrote:

> Hello everybody,
> I looked several times through the docs and couldn't find anything to solve my problem.
> I was wondering if I could save a plot directly to an image file without having to "fish" it out of the REPL and right click. I am looking into automatically creating a series of graphs directly evaluating scheme code, therefore using gplot lib, which is also pretty good would be an overkill.
> Any ideas?
> Thnx,
> Milan
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110117/dead00c4/attachment.html>

Posted on the users mailing list.