Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 2nd, 2013  |  syntax: Clojure  |  size: 0.56 KB  |  views: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. (ns test-chart
  2. (:require    (incanter
  3.               [core :as core]
  4.               [stats :as stats]
  5.               [charts :as charts]
  6.               [io :as io]
  7.               [datasets :as dset]))
  8. (:use clj-pdf.core))
  9.  
  10. (defn test-plot
  11.  []
  12.  (let [x (1 2 3 4)
  13.        y (1 3 5 7)
  14.        plot1 (charts/scatter-plot x y)
  15.        out (new java.io.ByteArrayOutputStream)]
  16.     (ChartUtilities/writeScaledChartAsPNG out plot1 300 200 1 1)
  17.     (.toByteArray out)))
  18.  
  19. (pdf [{} [:table {} [:cell [:image {} (test-plot)]
  20.              [:image {} (test-plot)]]]] "test.pdf")