This is a general 'view' function. When given an Incanter matrix/dataset
or a Clojure numeric collection, it will display it in a Java Swing
JTable. When given an Incanter chart object, it will display it in a new
window. When given a URL string, it will open the location with the
platform's default web browser.
When viewing charts, a :width (default 500) and :height (default 400)
option can be provided.
When viewing an incanter.processing sketch, set the :exit-on-close option
to true (default is false) to kill the animation processes when you
close the window (this will also kill your REPL or Swank server),
otherwise those processing will continue to run in the background.
Examples:
(use '(incanter core stats datasets charts))
;; view matrices
(def rand-mat (matrix (sample-normal 100) 4))
(view rand-mat)
;; view numeric collections
(view [1 2 3 4 5])
(view (sample-normal 100))
;; view Incanter datasets
(view (get-dataset :iris))
;; convert dataset to matrix, changing Species names to numeric codes
(view (to-matrix (get-dataset :iris)))
;; convert dataset to matrix, changing Species names to dummy variables
(view (to-matrix (get-dataset :iris) :dummies true))
;; view a chart
(view (histogram (sample-normal 1000)) :width 700 :height 700)
;; view a URL
(view "http://incanter.org")
;; view a PNG file
(save (histogram (sample-normal 1000)) "/tmp/norm_hist.png")
(view "file:///tmp/norm_hist.png")
Comments top
No comments for view. Log in to add a comment.