SHARE
TWEET

Untitled

a guest Jul 2nd, 2013 34 Never
  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")
RAW Paste Data
Top