[plt-scheme] PLoT and histograms

From: Paulo Jorge de Oliveira Cantante de Matos (pocm at sat.inesc-id.pt)
Date: Sat Jul 30 19:38:37 EDT 2005

Indeed, you're right.
So, here's my attempt at it:
;; Defining a new plot type to plot the frequency bars
  (define-plot-type histogram points 2dplotview
    () ((color 'red) (width 5))

    (send* 2dplotview
      (set-line-color color)
      (set-line-width width))

    (for-each
     (lambda (pts)
       (let [(vec-x (vector-ref pts 0))]
         (send 2dplotview plot-line (list (vector vec-x 0) pts))))
     points))

Which fails with the not so specific message:
define-plot-type: bad syntax in: (define-plot-type histogram
points 2dplotview () ((color (quote red)) (width 5)) (send*
2dplotview (set-line-color color) (set-line-width width))
(for-each (lambda (pts) (let ((vec-x (vector-ref pts 0))) (send
2dplotview plot-line (list (vector vec-x 0) pts)))) points))


Any ideas why there's a problem with the above? If I remove the
for-each everything works ok but I can't see a problem with it.

Paulo Matos

Matthias Felleisen said:
>
> On Jul 30, 2005, at 7:01 PM, Paulo Jorge de Oliveira Cantante
> de Matos
> wrote:
>
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>> Hi all,
>>
>> Has anyone tried to develop a histogram package using PLoT?
>> Is
>> it possible? I though so but right now something is coming to
>> my mind saying that it is not... since drawing a histogram is
>> conceptually different from function plotting! Any ideas?
>
> You can plot data points not just functions. I'd be surprised
> if this
> doesn't cover histograms. -- Matthias
>


-- 
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group



Posted on the users mailing list.