Skip to content
liebke edited this page Jan 9, 2011 · 26 revisions

Analemma

Analemma is a Clojure SVG DSL and charting library.


(spit "analemma.svg"
      (emit-svg
        (-> (xy-plot :xmin -30 :maxx 10,
                     :ymin -30 :maxy 30
                     :height 500 :width 500)
	     (add-points analemma-data))))


(spit "sin-cos.svg"
      (emit-svg
        (let [x (range -5 5 0.05)
              y1 (map #(Math/cos %) x)
              y2 (map #(Math/sin %) x)]
          (-> (xy-plot :minx -5 :xmax 5 :ymin -1.5 :maxy 1.5)
              (add-points [x y1] :transpose? true)
              (add-points [x y2] :transpose? true
                          :colors (repeat (count x) (rgb 255 0 0)))))

Copyright (C) 2011 David Edgar Liebke

Distributed under the Eclipse Public License, the same as Clojure.

Clone this wiki locally