Clot

CLOT (clot-20110308.src.tbz) is a simple library to plot data sets in charts of different types. Currently it supports bar, histogram, line, and pie charts, all with some optional graphic decorations. It requires SCLF and CL-GD. flower

Here are some examples:
[line chart example] A simple line chart.
[bar chart example] A bar chart with bars overlapped 50% horizontally.
[scattered bar chart example] A bar chart with scattered bars.
[pie chart example] A pie chart with a gray shadow on the background.
[histogram example] A histogram with areas filled with a washed down colour.
[mixed chart example] Four different charts on the same image. Note the automatic scaling done by clot.

The above images have been produced with the following code:

(be multi-data '(("Milano" "red" 0 2.3 3.2 14 5)
                 ("Bonn" "green" 5 13 7.5 5 0)
                 ("Birmingham" "blue" 0.9 2.2 3.1 0 2.5))
    simple-data '(("beer" "green" 200)
                  ("soda" "red" 20)
                  ("juice" "yellow" 40)
                  ("whiskey" "brown" 6)
                  ("water" "blue" 450))
    months '("January" "February" "March" "April" "May")
    tage '("Montag" "Diensttag" "Mittwoch" "Donnerstag" "Freitag")
  (defun make-samples ()
    (flet ((write-file (name)
             (write-image-to-file (make-pathname
                                        :defaults clot-system:*base-directory*
                                        :name name
                                        :type "png")
                                  :if-exists :supersede)))
      (with-image* (640 480)
        (fill-image 0 0 :color *default-background-colour*)
        (plot-line-chart multi-data)
        (write-file "line-chart"))
      (with-image* (640 480)
        (fill-image 0 0 :color *default-background-colour*)
        (plot-bar-chart multi-data :bar-width 1.5 :hgrid t)
        (write-file "bar-chart"))
      (with-image* (520 520)
        (fill-image 0 0 :color *default-background-colour*)
        (plot-pie-chart simple-data :shaded t)
        (write-file "pie-chart"))
      (with-image* (640 480)
        (fill-image 0 0 :color *default-background-colour*)
        (plot-histogram-chart multi-data :x-axis-labels months :hgrid t :shaded t)
        (write-file "histogram-chart"))
      (with-image* (640 480)
        (fill-image 0 0 :color *default-background-colour*)
        (plot-bar-chart multi-data :x-axis-labels months :bar-width .8 :vgrid t)
        (write-file "scattered-bar-chart"))
      (with-image* (1024 768)
        (fill-image 0 0 :color *default-background-colour*)
        (with-subimage (0 0 (/ (image-width) 2) (/ (image-height) 2))
          (plot-line-chart multi-data :bullets t :hgrid t))
        (with-subimage (0 (/ (image-height) 2) (/ (image-width) 2) (image-height))
          (plot-histogram-chart multi-data :x-axis-labels months :hgrid t))
        (with-subimage ((/ (image-width) 2) 0 (image-width) (/ (image-height) 2))
          (plot-bar-chart multi-data :bar-width 1.3
                          :x-axis-labels tage :hgrid t))
        (with-subimage ((/ (image-width) 2) (/ (image-height) 2)
                        (image-width) (image-height))
          (plot-pie-chart simple-data :shaded t))
        (write-file "mixed-chart")))
    (values))
All the photographs on these pages are copyright Walter C. Pelissero. All rights are reserved. No copy, manipulation or transfer, beside for the sake of personal view of the page where they appear on, is allowed. Also the direct linking of web pages to the single photograph image is forbidden.
If you need to have them, much higher resolution hard copies are available on request.
stopsoftwarepatents.eu petition banner

home
Copyright © Walter C. Pelissero, all rights reserved
Last modified: Sat Feb 20 22:53:57 CET 2010
Valid html 4.01!