SlideShare a Scribd company logo
Incanter Data Sorcery
David Edgar Liebke
liebke@incanter.org
Data Sorcery with
Clojure & Incanter
Introduction to
Datasets & Charts
Datasets
•Creating
•Reading data
•Saving data
•Column selection
•Row selection
•Sorting
•Rolling up
Overview
•What is Incanter?
•Getting started
•Incanter libraries
Charts
•Scatter plots
•Chart options
•Saving charts
•Adding data
•Bar & line charts
•XY & function plots
•Histograms & box-plots
•Annotating charts
Wrap up
Outline
Datasets
•Creating
•Reading data
•Saving data
•Column selection
•Row selection
•Sorting
•Rolling up
Overview
•What is Incanter?
•Getting started
•Incanter libraries
Charts
•Scatter plots
•Chart options
•Saving charts
•Adding data
•Bar & line charts
•XY & function plots
•Histograms & box-plots
•Annotating charts
Wrap up
Outline
overviewWhat is Incanter?
Incanter is a Clojure-based, R-like
platform for statistical computing
and graphics.
It can be used either as a standalone,
interactive data analysis environment or
embedded within other analytics systems as a
modular suite of libraries.
Features
•Charting & visualization functions
•Data manipulation functions
•Mathematical functions
•Statistical functions
•Matrix & linear algebra functions
•Machine learning functions
who is Incanter?What is Incanter?
Committers
•David Edgar Liebke
•Bradford Cross (FlightCaster)
•Alex Ott (build master)
•Tom Faulhaber (autodoc)
•Sean Devlin (chrono 2.0)
•Jared Strate (FlightCaster)
Contributors
•Chris Burroughs
•Phil Hagelberg
•Edmund Jackson (proposed time-series)
•Steve Jenson
•Steve Purcell
•Brendan Ribera
•Alexander Stoddard
Community
•Incanter Google group (108 members)
•Github repository (197 watchers, 16 forks)
Related project
•Rincanter (Joel Boehland)
As of 10 February 2010
Getting started incanter.org website
Getting started data-sorcery.org blog
quick startGetting started
$ wget http://incanter.org/downloads/incanter-1.0-SNAPSHOT.zip
$ unzip incanter-1.0-SNAPSHOT.zip
$ cd incanter
$ bin/clj
user=> (use '(incanter core charts))
user=> (view (function-plot sin -4 4)))
•bayes
•censored
•charts (based on JFreeChart)
•chrono (based on JodaTime)
•classification
•core (based on ParallelColt)
•datasets
•incremental-stats
•information-theory
•internal
•io
•mongodb (based on Congomongo)
•optimize
•pdf (based on iText)
•probability
•processing (based on Processing)
•som
•stats (based on ParallelColt)
•transformations
list of Incanter namespacesIncanter libraries
we will focus on charts & dataset functions in coreIncanter libraries
•bayes
•censored
•charts
•chrono
•classification
•core
•datasets
•incremental-stats
•information-theory
•internal
•io
•mongodb
•optimize
•pdf
•probability
•processing
•som
•stats
•transformations
using functions from a few other namespacesIncanter libraries
•bayes
•censored
•charts
•chrono
•classification
•core
•datasets
•incremental-stats
•information-theory
•internal
•io
•mongodb
•optimize
•pdf
•probability
•processing
•som
•stats
•transformations
Datasets
•Creating
•Reading data
•Saving data
•Column selection
•Row selection
•Sorting
•Rolling up
Overview
•What is Incanter?
•Getting started
•Incanter libraries
Charts
•Scatter plots
•Chart options
•Saving charts
•Adding data
•Bar & line charts
•XY & function plots
•Histograms & box-plots
•Annotating charts
Wrap up
Outline
(use 'incanter.core)
(dataset ["x1" "x2" "x3"]
[[1 2 3]
[4 5 6]
[7 8 9]])
(to-dataset [{"x1" 1, "x2" 2, "x3" 3}
{"x1" 4, "x2" 5, "x3" 6}
{"x1" 7, "x2" 8, "x3" 9}])
(to-dataset [[1 2 3]
[4 5 6]
[7 8 9]])
(conj-cols [1 4 7] [2 5 8] [3 6 9])
(conj-rows [1 2 3] [4 5 6] [7 8 9])
Creating datasets create a small dataset
(use 'incanter.core)
(dataset ["x1" "x2" "x3"]
[[1 2 3]
[4 5 6]
[7 8 9]])
(to-dataset [{"x1" 1, "x2" 2, "x3" 3}
{"x1" 4, "x2" 5, "x3" 6}
{"x1" 7, "x2" 8, "x3" 9}])
(to-dataset [[1 2 3]
[4 5 6]
[7 8 9]])
(conj-cols [1 4 7] [2 5 8] [3 6 9])
(conj-rows [1 2 3] [4 5 6] [7 8 9])
convert a sequence of mapsCreating datasets
(use 'incanter.core)
(dataset ["x1" "x2" "x3"]
[[1 2 3]
[4 5 6]
[7 8 9]])
(to-dataset [{"x1" 1, "x2" 2, "x3" 3}
{"x1" 4, "x2" 5, "x3" 6}
{"x1" 7, "x2" 8, "x3" 9}])
(to-dataset [[1 2 3]
[4 5 6]
[7 8 9]])
(conj-cols [1 4 7] [2 5 8] [3 6 9])
(conj-rows [1 2 3] [4 5 6] [7 8 9])
convert a sequence of sequencesCreating datasets
(use 'incanter.core)
(dataset ["x1" "x2" "x3"]
[[1 2 3]
[4 5 6]
[7 8 9]])
(to-dataset [{"x1" 1, "x2" 2, "x3" 3}
{"x1" 4, "x2" 5, "x3" 6}
{"x1" 7, "x2" 8, "x3" 9}])
(to-dataset [[1 2 3]
[4 5 6]
[7 8 9]])
(conj-cols [1 4 7] [2 5 8] [3 6 9])
(conj-rows [1 2 3] [4 5 6] [7 8 9])
conj columns togetherCreating datasets
(use 'incanter.core)
(dataset ["x1" "x2" "x3"]
[[1 2 3]
[4 5 6]
[7 8 9]])
(to-dataset [{"x1" 1, "x2" 2, "x3" 3}
{"x1" 4, "x2" 5, "x3" 6}
{"x1" 7, "x2" 8, "x3" 9}])
(to-dataset [[1 2 3]
[4 5 6]
[7 8 9]])
(conj-cols [1 4 7] [2 5 8] [3 6 9])
(conj-rows [1 2 3] [4 5 6] [7 8 9])
conj rows togetherCreating datasets
(use '(incanter core io))
(read-dataset "./data/cars.csv"
:header true)
(read-dataset "./data/cars.tdd"
:header true
:delim tab)
(read-dataset "http://bit.ly/aZyjKa"
:header true)
(use 'incanter.datasets)
(get-dataset :cars)
(use 'incanter.mongodb)
(use 'somnium.congomongo)
(mongo! :db "mydb")
(view (fetch-dataset :cars))
Reading data read a comma-delimited file
(use '(incanter core io))
(read-dataset "./data/cars.csv"
:header true)
(read-dataset "./data/cars.tdd"
:header true
:delim tab)
(read-dataset "http://bit.ly/aZyjKa"
:header true)
(use 'incanter.datasets)
(get-dataset :cars)
(use 'incanter.mongodb)
(use 'somnium.congomongo)
(mongo! :db "mydb")
(view (fetch-dataset :cars))
Reading data read a tab-delimited file
(use '(incanter core io))
(read-dataset "./data/cars.csv"
:header true)
(read-dataset "./data/cars.tdd"
:header true
:delim tab)
(read-dataset "http://bit.ly/aZyjKa"
:header true)
(use 'incanter.datasets)
(get-dataset :cars)
(use 'incanter.mongodb)
(use 'somnium.congomongo)
(mongo! :db "mydb")
(view (fetch-dataset :cars))
Reading data read a comma-delimited file from a URL
(use '(incanter core io))
(read-dataset "./data/cars.csv"
:header true)
(read-dataset "./data/cars.tdd"
:header true
:delim tab)
(read-dataset "http://bit.ly/aZyjKa"
:header true)
(use 'incanter.datasets)
(get-dataset :cars)
(use 'incanter.mongodb)
(use 'somnium.congomongo)
(mongo! :db "mydb")
(view (fetch-dataset :cars))
Reading data read a built-in sample dataset
(use '(incanter core io))
(read-dataset "./data/cars.csv"
:header true)
(read-dataset "./data/cars.tdd"
:header true
:delim tab)
(read-dataset "http://bit.ly/aZyjKa"
:header true)
(use 'incanter.datasets)
(get-dataset :cars)
(use 'incanter.mongodb)
(use 'somnium.congomongo)
(mongo! :db "mydb")
(view (fetch-dataset :cars))
Reading data retrieve a dataset from MongoDB
(use '(incanter core io))
(save data "./data.csv")
(use '(incanter core mongodb))
(use 'somnium.congomongo)
(mongo! :db "mydb")
(insert-dataset :cars data)
Saving data save a dataset in a CSV file
Saving data save a dataset in a MongoDB database
(use '(incanter core io))
(save data "./data.csv")
(use '(incanter core mongodb))
(use 'somnium.congomongo)
(mongo! :db "mydb")
(insert-dataset :cars data)
(use '(incanter core datasets))
($ :speed (get-dataset :cars))
(4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24
25)
(with-data (get-dataset :cars)
[(mean ($ :speed))
(sd ($ :speed))])
(with-data (get-dataset :iris)
(view $data)
(view ($ [:Sepal.Length :Sepal.Width :Species])))
Column selection select a single column
(use '(incanter core datasets))
($ :speed (get-dataset :cars))
(4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24
25)
(with-data (get-dataset :cars)
[(mean ($ :speed))
(sd ($ :speed))])
[15.4 5.29]
(with-data (get-dataset :iris)
(view $data)
(view ($ [:Sepal.Length :Sepal.Width :Species])))
Column selection use with-data macro to bind dataset
(use '(incanter core datasets))
($ :speed (get-dataset :cars))
(4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24
25)
(with-data (get-dataset :cars)
[(mean ($ :speed))
(sd ($ :speed))])
[15.4 5.29]
(with-data (get-dataset :iris)
(view $data)
(view ($ [:Sepal.Length :Sepal.Width :Species])))
Column selection view dataset bound to $data
(use '(incanter core datasets))
($ :speed (get-dataset :cars))
(4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24
25)
(with-data (get-dataset :cars)
[(mean ($ :speed))
(sd ($ :speed))])
[15.4 5.29]
(with-data (get-dataset :iris)
(view $data)
(view ($ [:Sepal.Length :Sepal.Width :Species])))
Column selection select multiple columns
(use '(incanter core datasets))
($where {"Species" "setosa"}
(get-dataset :iris))
($where {"Petal.Width" {:lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}
"Species" {:in #{"virginica" "setosa"}}}
(get-dataset :iris))
($where (fn [row]
(or (< (row "Petal.Width") 1.0)
(> (row "Petal.Length") 5.0)))
(get-dataset :iris))
Row selection select rows where species equals ‘setosa’
(use '(incanter core datasets))
($where {"Species" "setosa"}
(get-dataset :iris))
($where {"Petal.Width" {:lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}
"Species" {:in #{"virginica" "setosa"}}}
(get-dataset :iris))
($where (fn [row]
(or (< (row "Petal.Width") 1.0)
(> (row "Petal.Length") 5.0)))
(get-dataset :iris))
Row selection select rows where petal-width < 1.5
(use '(incanter core datasets))
($where {"Species" "setosa"}
(get-dataset :iris))
($where {"Petal.Width" {:lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}
"Species" {:in #{"virginica" "setosa"}}}
(get-dataset :iris))
($where (fn [row]
(or (< (row "Petal.Width") 1.0)
(> (row "Petal.Length") 5.0)))
(get-dataset :iris))
Row selection select rows where 1.0 < petal-width < 1.5
(use '(incanter core datasets))
($where {"Species" "setosa"}
(get-dataset :iris))
($where {"Petal.Width" {:lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}
"Species" {:in #{"virginica" "setosa"}}}
(get-dataset :iris))
($where (fn [row]
(or (< (row "Petal.Width") 1.0)
(> (row "Petal.Length") 5.0)))
(get-dataset :iris))
Row selection select rows where species is ‘virginica’ or ‘setosa’
(use '(incanter core datasets))
($where {"Species" "setosa"}
(get-dataset :iris))
($where {"Petal.Width" {:lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}}
(get-dataset :iris))
($where {"Petal.Width" {:gt 1.0, :lt 1.5}
"Species" {:in #{"virginica" "setosa"}}}
(get-dataset :iris))
($where (fn [row]
(or (< (row "Petal.Width") 1.0)
(> (row "Petal.Length") 5.0)))
(get-dataset :iris))
Row selection select rows using an arbitrary predicate function
Sorting data hair & eye color data
(use '(incanter core datasets))
(with-data (get-dataset :hair-eye-color)
(view $data)
(view ($order :count :desc))
(view ($order [:hair :eye] :desc)))
Sorting data sort by count in descending order
(use '(incanter core datasets))
(with-data (get-dataset :hair-eye-color)
(view $data)
(view ($order :count :desc))
(view ($order [:hair :eye] :desc)))
Sorting data sort by hair and then eye color
(use '(incanter core datasets))
(with-data (get-dataset :hair-eye-color)
(view $data)
(view ($order :count :desc))
(view ($order [:hair :eye] :desc)))
Rolling up data mean petal-length by species
(use '(incanter core datasets stats))
(->> (get-dataset :iris)
($rollup mean :Petal.Length :Species)
view)
(->> (get-dataset :iris)
($rollup #(/ (sd %) (count %))
:Petal.Length :Species)
view)
(->> (get-dataset :hair-eye-color)
($rollup sum :count [:hair :eye])
($order :count :desc)
view)
Rolling up data standard error of petal-length
(use '(incanter core datasets stats))
(->> (get-dataset :iris)
($rollup mean :Petal.Length :Species)
view)
(->> (get-dataset :iris)
($rollup #(/ (sd %) (count %))
:Petal.Length :Species)
view)
(->> (get-dataset :hair-eye-color)
($rollup sum :count [:hair :eye])
($order :count :desc)
view)
Rolling up data sum of people with each hair/eye color combination
(use '(incanter core datasets stats))
(->> (get-dataset :iris)
($rollup mean :Petal.Length :Species)
view)
(->> (get-dataset :iris)
($rollup #(/ (sd %) (count %))
:Petal.Length :Species)
view)
(->> (get-dataset :hair-eye-color)
($rollup sum :count [:hair :eye])
($order :count :desc)
view)
Rolling up data sorted from most to least common
(use '(incanter core datasets stats))
(->> (get-dataset :iris)
($rollup mean :Petal.Length :Species)
view)
(->> (get-dataset :iris)
($rollup #(/ (sd %) (count %))
:Petal.Length :Species)
view)
(->> (get-dataset :hair-eye-color)
($rollup sum :count [:hair :eye])
($order :count :desc)
view)
Datasets
•Creating
•Reading data
•Saving data
•Column selection
•Row selection
•Sorting
•Rolling up
Overview
•What is Incanter?
•Getting started
•Incanter libraries
Charts
•Scatter plots
•Chart options
•Saving charts
•Adding data
•Bar & line charts
•XY & function plots
•Histograms & box-plots
•Annotating charts
Wrap up
Outline
(view (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)))
Scatter plots plot ‘sepal length’ vs ‘sepal width’
(view (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark))
use dark chart themeChart options
(view (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark
:group-by :Species))
group by species valuesChart options
(view (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark
:group-by :Species
:title "Fisher Iris Data"
:x-label "Sepal Length (cm)"
:y-label "Sepal Width (cm)"))
change chart title & axes labelsChart options
(save (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark
:group-by :Species
:title "Fisher Iris Data"
:x-label "Sepal Length (cm)"
:y-label "Sepal Width (cm)")
"./iris-plot.png")
Saving charts save chart to a PNG file
(def output-stream (java.io.ByteArrayOutputStream.))
(save (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark
:group-by :Species
:title "Fisher Iris Data"
:x-label "Sepal Length (cm)"
:y-label "Sepal Width (cm)")
output-stream)
save chart to an OutputStreamSaving charts
(use 'incanter.pdf)
(save-pdf (scatter-plot :Sepal.Length :Sepal.Width
:data (get-dataset :iris)
:theme :dark
:group-by :Species
:title "Fisher Iris Data"
:x-label "Sepal Length (cm)"
:y-label "Sepal Width (cm)")
"./iris-plot.pdf")
save chart to a PDF fileSaving charts
(use '(incanter core charts datasets))
(with-data (get-dataset :iris)
(doto (scatter-plot :Petal.Width :Petal.Length
:theme :dark
:data ($where {"Petal.Length" {:lte 2.0}
"Petal.Width" {:lt 0.75}}))
view)))
Adding data plot points where petal-length <= 2 & petal-width < .75
(use '(incanter core charts datasets))
(with-data (get-dataset :iris)
(doto (scatter-plot :Petal.Width :Petal.Length
:theme :dark
:data ($where {"Petal.Length" {:lte 2.0}
"Petal.Width" {:lt 0.75}}))
(add-points :Petal.Width :Petal.Length
:data ($where {"Petal.Length" {:gt 2.0}
"Petal.Width" {:gte 0.75}}))
view)))
add points where petal-length > 2 & petal-width >= .75Adding data
(use '(incanter core charts datasets stats))
(with-data (get-dataset :iris)
(let [lm (linear-model ($ :Petal.Length) ($ :Petal.Width))]
(doto (scatter-plot :Petal.Width :Petal.Length
:theme :dark
:data ($where {"Petal.Length" {:lte 2.0}
"Petal.Width" {:lt 0.75}}))
(add-points :Petal.Width :Petal.Length
:data ($where {"Petal.Length" {:gt 2.0}
"Petal.Width" {:gte 0.75}}))
(add-lines :Petal.Width (:fitted lm))
view)))
add a regression lineAdding data
(use '(incanter core charts datasets))
(with-data ($rollup mean :Sepal.Length :Species
(get-dataset :iris))
(view (bar-chart :Species :Sepal.Length
:theme :dark)))
Bar & line charts bar-chart of mean sepal-length for each species
(use '(incanter core charts datasets))
(with-data ($rollup mean :Sepal.Length :Species
(get-dataset :iris))
(view (line-chart :Species :Sepal.Length
:theme :dark)))
Bar & line charts line-chart of mean sepal-length for each species
(with-data ($rollup :mean :count [:hair :eye]
(get-dataset :hair-eye-color))
(view $data)
(view (bar-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts rollup the :count column using mean
(with-data ($rollup :mean :count [:hair :eye]
(get-dataset :hair-eye-color))
(view $data)
(view (bar-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts bar-chart grouped by eye color
(with-data ($rollup :mean :count [:hair :eye]
(get-dataset :hair-eye-color))
(view $data)
(view (line-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts line-chart grouped by eye color
(with-data (->> (get-dataset :hair-eye-color)
($where {:hair {:in #{"brown" "blond"}}})
($rollup :sum :count [:hair :eye])
($order :count :desc))
(view $data)
(view (bar-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts sort by sum of :count column
(with-data (->> (get-dataset :hair-eye-color)
($where {:hair {:in #{"brown" "blond"}}})
($rollup :sum :count [:hair :eye])
($order :count :desc))
(view $data)
(view (bar-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts bar-chart grouped by eye color
(with-data (->> (get-dataset :hair-eye-color)
($where {:hair {:in #{"brown" "blond"}}})
($rollup :sum :count [:hair :eye])
($order :count :desc))
(view $data)
(view (line-chart :hair :count
:group-by :eye
:legend true
:theme :dark)))
Bar & line charts line-chart grouped by eye color
xy-plot of two continuous variablesXY & function plots
(use '(incanter (core charts)))
(with-data (get-dataset :cars)
(view (xy-plot :speed :dist
:theme :dark)))
function-plot of x3+2x2+2x+3XY & function plots
(use '(incanter (core charts optimize)))
(defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3))
(doto (function-plot cubic -10 10 :theme :dark)
view)
add the derivative of the functionXY & function plots
(use '(incanter (core charts optimize)))
(defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3))
(doto (function-plot cubic -10 10 :theme :dark)
(add-function (derivative cubic) -10 10)
view)
add a sine waveXY & function plots
(use '(incanter (core charts optimize)))
(defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3))
(doto (function-plot cubic -10 10 :theme :dark)
(add-function (derivative cubic) -10 10)
(add-function #(* 1000 (sin %)) -10 10)
view)
plot a sample from a gamma distributionHistograms & box-plots
(use '(incanter (core charts stats)))
(doto (histogram (sample-gamma 1000)
:density true
:nbins 30
:theme :dark)
view)
add a gamma pdf lineHistograms & box-plots
(use '(incanter (core charts stats)))
(doto (histogram (sample-gamma 1000)
:density true
:nbins 30
:theme :dark)
(add-function pdf-gamma 0 8)
view)
box-plots of petal-width grouped by speciesHistograms & box-plots
(use '(incanter core datasets))
(with-data (get-dataset :iris)
(view (box-plot :Petal.Width
:group-by :Species
:theme :dark)))
plot sin waveAnnotating charts
(use '(incanter core charts))
(doto (function-plot sin -10 10)
view)
add text annotation (black text only)Annotating charts
(use '(incanter core charts))
(doto (function-plot sin -10 10)
(add-text 0 0 "text at (0,0)")
view)
add pointer annotationsAnnotating charts
(use '(incanter core charts))
(doto (function-plot sin -10 10)
(add-text 0 0 "text at (0,0)")
(add-pointer (- Math/PI) (sin (- Math/PI))
:text "pointer at (sin -pi)")
(add-pointer Math/PI (sin Math/PI)
:text "pointer at(sin pi)"
:angle :ne)
(add-pointer (* 1/2 Math/PI) (sin (* 1/2 Math/PI))
:text "pointer at(sin pi/2)"
:angle :south)
view)
Datasets
•Creating
•Reading data
•Saving data
•Column selection
•Row selection
•Sorting
•Rolling up
Overview
•What is Incanter?
•Getting started
•Incanter libraries
Charts
•Scatter plots
•Chart options
•Saving charts
•Adding data
•Bar & line charts
•XY & function plots
•Histograms & box-plots
•Annotating charts
Wrap up
Outline
learn more and contributeWrap up
Learn more
•Visit http://incanter.org
•Visit http://data-sorcery.org
Join the community and contribute
•Join the Google group: http://groups.google.com/group/incanter
•Follow Incanter on Github: http://github.com/liebke/incanter
•Follow @liebke on Twitter
Thank you
Ad

More Related Content

What's hot (20)

Cours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corbaCours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corba
Mariem ZAOUALI
 
Les Streams de Java 8
Les Streams de Java 8Les Streams de Java 8
Les Streams de Java 8
Antoine Rey
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
GlowTouch
 
Practical Object Oriented Models In Sql
Practical Object Oriented Models In SqlPractical Object Oriented Models In Sql
Practical Object Oriented Models In Sql
Karwin Software Solutions LLC
 
Composants Android
Composants AndroidComposants Android
Composants Android
Lilia Sfaxi
 
Présentation de Thèse
Présentation de ThèsePrésentation de Thèse
Présentation de Thèse
Lilia Sfaxi
 
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Jungsik Choi
 
multiple linear regression
multiple linear regressionmultiple linear regression
multiple linear regression
Akhilesh Joshi
 
Comportement de l'internaute
Comportement de l'internauteComportement de l'internaute
Comportement de l'internaute
FredericJutant
 
Linux Virus
Linux VirusLinux Virus
Linux Virus
Akhil Kadangode
 
Cours python avancé
Cours python avancéCours python avancé
Cours python avancé
pierrepo
 
llvm 소개
llvm 소개llvm 소개
llvm 소개
Minhyuk Kwon
 
Le Reseau De Neurones
Le Reseau De NeuronesLe Reseau De Neurones
Le Reseau De Neurones
guestf80d95
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
James Johnson
 
Introduction to Python Celery
Introduction to Python CeleryIntroduction to Python Celery
Introduction to Python Celery
Mahendra M
 
Introduction à Python
Introduction à PythonIntroduction à Python
Introduction à Python
Abdoulaye Dieng
 
POO Java Chapitre 3 Collections
POO Java Chapitre 3 CollectionsPOO Java Chapitre 3 Collections
POO Java Chapitre 3 Collections
Mouna Torjmen
 
파이썬 Numpy 선형대수 이해하기
파이썬 Numpy 선형대수 이해하기파이썬 Numpy 선형대수 이해하기
파이썬 Numpy 선형대수 이해하기
Yong Joon Moon
 
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
삵 (sarc.io)
 
Cours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corbaCours 3 les objets distants rmi corba
Cours 3 les objets distants rmi corba
Mariem ZAOUALI
 
Les Streams de Java 8
Les Streams de Java 8Les Streams de Java 8
Les Streams de Java 8
Antoine Rey
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
GlowTouch
 
Composants Android
Composants AndroidComposants Android
Composants Android
Lilia Sfaxi
 
Présentation de Thèse
Présentation de ThèsePrésentation de Thèse
Présentation de Thèse
Lilia Sfaxi
 
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Efficient Memory Mapped File I/O for In-Memory File Systems (HotStorage '17)
Jungsik Choi
 
multiple linear regression
multiple linear regressionmultiple linear regression
multiple linear regression
Akhilesh Joshi
 
Comportement de l'internaute
Comportement de l'internauteComportement de l'internaute
Comportement de l'internaute
FredericJutant
 
Cours python avancé
Cours python avancéCours python avancé
Cours python avancé
pierrepo
 
Le Reseau De Neurones
Le Reseau De NeuronesLe Reseau De Neurones
Le Reseau De Neurones
guestf80d95
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
James Johnson
 
Introduction to Python Celery
Introduction to Python CeleryIntroduction to Python Celery
Introduction to Python Celery
Mahendra M
 
POO Java Chapitre 3 Collections
POO Java Chapitre 3 CollectionsPOO Java Chapitre 3 Collections
POO Java Chapitre 3 Collections
Mouna Torjmen
 
파이썬 Numpy 선형대수 이해하기
파이썬 Numpy 선형대수 이해하기파이썬 Numpy 선형대수 이해하기
파이썬 Numpy 선형대수 이해하기
Yong Joon Moon
 
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
LUA를 이용한 스마트한 웹서버 만들기 (Ray. Lee)
삵 (sarc.io)
 

Similar to Incanter Data Sorcery (20)

R programming & Machine Learning
R programming & Machine LearningR programming & Machine Learning
R programming & Machine Learning
AmanBhalla14
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
Andrew Lamb
 
Data Exploration in R.pptx
Data Exploration in R.pptxData Exploration in R.pptx
Data Exploration in R.pptx
Ramakrishna Reddy Bijjam
 
python-numpyandpandas-170922144956 (1).pptx
python-numpyandpandas-170922144956 (1).pptxpython-numpyandpandas-170922144956 (1).pptx
python-numpyandpandas-170922144956 (1).pptx
Akashgupta517936
 
R Programming: Numeric Functions In R
R Programming: Numeric Functions In RR Programming: Numeric Functions In R
R Programming: Numeric Functions In R
Rsquared Academy
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
Matthias Niehoff
 
R Introduction
R IntroductionR Introduction
R Introduction
Sangeetha S
 
Graph computation
Graph computationGraph computation
Graph computation
Sigmoid
 
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Databricks
 
Aggregate.pptx
Aggregate.pptxAggregate.pptx
Aggregate.pptx
Ramakrishna Reddy Bijjam
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Andrew Ferlitsch
 
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
HendraPurnama31
 
python-numwpyandpandas-170922144956.pptx
python-numwpyandpandas-170922144956.pptxpython-numwpyandpandas-170922144956.pptx
python-numwpyandpandas-170922144956.pptx
smartashammari
 
Beyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFramesBeyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFrames
Databricks
 
R training3
R training3R training3
R training3
Hellen Gakuruh
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web Apps
EPAM
 
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptxfINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
dataKarthik
 
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Stefan Urbanek
 
Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015
eddiebaggott
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark Meetup
Databricks
 
R programming & Machine Learning
R programming & Machine LearningR programming & Machine Learning
R programming & Machine Learning
AmanBhalla14
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
Andrew Lamb
 
python-numpyandpandas-170922144956 (1).pptx
python-numpyandpandas-170922144956 (1).pptxpython-numpyandpandas-170922144956 (1).pptx
python-numpyandpandas-170922144956 (1).pptx
Akashgupta517936
 
R Programming: Numeric Functions In R
R Programming: Numeric Functions In RR Programming: Numeric Functions In R
R Programming: Numeric Functions In R
Rsquared Academy
 
Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra Big data analytics with Spark & Cassandra
Big data analytics with Spark & Cassandra
Matthias Niehoff
 
Graph computation
Graph computationGraph computation
Graph computation
Sigmoid
 
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Spark Summit EU 2015: Spark DataFrames: Simple and Fast Analysis of Structure...
Databricks
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Andrew Ferlitsch
 
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
Matplotlib adalah pustaka plotting 2D Python yang menghasilkan gambar berkual...
HendraPurnama31
 
python-numwpyandpandas-170922144956.pptx
python-numwpyandpandas-170922144956.pptxpython-numwpyandpandas-170922144956.pptx
python-numwpyandpandas-170922144956.pptx
smartashammari
 
Beyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFramesBeyond SQL: Speeding up Spark with DataFrames
Beyond SQL: Speeding up Spark with DataFrames
Databricks
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web Apps
EPAM
 
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptxfINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
dataKarthik
 
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Stefan Urbanek
 
Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015Dublin Ireland Spark Meetup October 15, 2015
Dublin Ireland Spark Meetup October 15, 2015
eddiebaggott
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark Meetup
Databricks
 
Ad

More from elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
elliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
elliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
elliando dias
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
Ragel talk
Ragel talkRagel talk
Ragel talk
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
elliando dias
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
elliando dias
 
Rango
RangoRango
Rango
elliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 
Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
elliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
elliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
elliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 
Ad

Recently uploaded (20)

Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 

Incanter Data Sorcery

  • 2. David Edgar Liebke [email protected] Data Sorcery with Clojure & Incanter Introduction to Datasets & Charts
  • 3. Datasets •Creating •Reading data •Saving data •Column selection •Row selection •Sorting •Rolling up Overview •What is Incanter? •Getting started •Incanter libraries Charts •Scatter plots •Chart options •Saving charts •Adding data •Bar & line charts •XY & function plots •Histograms & box-plots •Annotating charts Wrap up Outline
  • 4. Datasets •Creating •Reading data •Saving data •Column selection •Row selection •Sorting •Rolling up Overview •What is Incanter? •Getting started •Incanter libraries Charts •Scatter plots •Chart options •Saving charts •Adding data •Bar & line charts •XY & function plots •Histograms & box-plots •Annotating charts Wrap up Outline
  • 5. overviewWhat is Incanter? Incanter is a Clojure-based, R-like platform for statistical computing and graphics. It can be used either as a standalone, interactive data analysis environment or embedded within other analytics systems as a modular suite of libraries. Features •Charting & visualization functions •Data manipulation functions •Mathematical functions •Statistical functions •Matrix & linear algebra functions •Machine learning functions
  • 6. who is Incanter?What is Incanter? Committers •David Edgar Liebke •Bradford Cross (FlightCaster) •Alex Ott (build master) •Tom Faulhaber (autodoc) •Sean Devlin (chrono 2.0) •Jared Strate (FlightCaster) Contributors •Chris Burroughs •Phil Hagelberg •Edmund Jackson (proposed time-series) •Steve Jenson •Steve Purcell •Brendan Ribera •Alexander Stoddard Community •Incanter Google group (108 members) •Github repository (197 watchers, 16 forks) Related project •Rincanter (Joel Boehland) As of 10 February 2010
  • 9. quick startGetting started $ wget http://incanter.org/downloads/incanter-1.0-SNAPSHOT.zip $ unzip incanter-1.0-SNAPSHOT.zip $ cd incanter $ bin/clj user=> (use '(incanter core charts)) user=> (view (function-plot sin -4 4)))
  • 10. •bayes •censored •charts (based on JFreeChart) •chrono (based on JodaTime) •classification •core (based on ParallelColt) •datasets •incremental-stats •information-theory •internal •io •mongodb (based on Congomongo) •optimize •pdf (based on iText) •probability •processing (based on Processing) •som •stats (based on ParallelColt) •transformations list of Incanter namespacesIncanter libraries
  • 11. we will focus on charts & dataset functions in coreIncanter libraries •bayes •censored •charts •chrono •classification •core •datasets •incremental-stats •information-theory •internal •io •mongodb •optimize •pdf •probability •processing •som •stats •transformations
  • 12. using functions from a few other namespacesIncanter libraries •bayes •censored •charts •chrono •classification •core •datasets •incremental-stats •information-theory •internal •io •mongodb •optimize •pdf •probability •processing •som •stats •transformations
  • 13. Datasets •Creating •Reading data •Saving data •Column selection •Row selection •Sorting •Rolling up Overview •What is Incanter? •Getting started •Incanter libraries Charts •Scatter plots •Chart options •Saving charts •Adding data •Bar & line charts •XY & function plots •Histograms & box-plots •Annotating charts Wrap up Outline
  • 14. (use 'incanter.core) (dataset ["x1" "x2" "x3"] [[1 2 3] [4 5 6] [7 8 9]]) (to-dataset [{"x1" 1, "x2" 2, "x3" 3} {"x1" 4, "x2" 5, "x3" 6} {"x1" 7, "x2" 8, "x3" 9}]) (to-dataset [[1 2 3] [4 5 6] [7 8 9]]) (conj-cols [1 4 7] [2 5 8] [3 6 9]) (conj-rows [1 2 3] [4 5 6] [7 8 9]) Creating datasets create a small dataset
  • 15. (use 'incanter.core) (dataset ["x1" "x2" "x3"] [[1 2 3] [4 5 6] [7 8 9]]) (to-dataset [{"x1" 1, "x2" 2, "x3" 3} {"x1" 4, "x2" 5, "x3" 6} {"x1" 7, "x2" 8, "x3" 9}]) (to-dataset [[1 2 3] [4 5 6] [7 8 9]]) (conj-cols [1 4 7] [2 5 8] [3 6 9]) (conj-rows [1 2 3] [4 5 6] [7 8 9]) convert a sequence of mapsCreating datasets
  • 16. (use 'incanter.core) (dataset ["x1" "x2" "x3"] [[1 2 3] [4 5 6] [7 8 9]]) (to-dataset [{"x1" 1, "x2" 2, "x3" 3} {"x1" 4, "x2" 5, "x3" 6} {"x1" 7, "x2" 8, "x3" 9}]) (to-dataset [[1 2 3] [4 5 6] [7 8 9]]) (conj-cols [1 4 7] [2 5 8] [3 6 9]) (conj-rows [1 2 3] [4 5 6] [7 8 9]) convert a sequence of sequencesCreating datasets
  • 17. (use 'incanter.core) (dataset ["x1" "x2" "x3"] [[1 2 3] [4 5 6] [7 8 9]]) (to-dataset [{"x1" 1, "x2" 2, "x3" 3} {"x1" 4, "x2" 5, "x3" 6} {"x1" 7, "x2" 8, "x3" 9}]) (to-dataset [[1 2 3] [4 5 6] [7 8 9]]) (conj-cols [1 4 7] [2 5 8] [3 6 9]) (conj-rows [1 2 3] [4 5 6] [7 8 9]) conj columns togetherCreating datasets
  • 18. (use 'incanter.core) (dataset ["x1" "x2" "x3"] [[1 2 3] [4 5 6] [7 8 9]]) (to-dataset [{"x1" 1, "x2" 2, "x3" 3} {"x1" 4, "x2" 5, "x3" 6} {"x1" 7, "x2" 8, "x3" 9}]) (to-dataset [[1 2 3] [4 5 6] [7 8 9]]) (conj-cols [1 4 7] [2 5 8] [3 6 9]) (conj-rows [1 2 3] [4 5 6] [7 8 9]) conj rows togetherCreating datasets
  • 19. (use '(incanter core io)) (read-dataset "./data/cars.csv" :header true) (read-dataset "./data/cars.tdd" :header true :delim tab) (read-dataset "http://bit.ly/aZyjKa" :header true) (use 'incanter.datasets) (get-dataset :cars) (use 'incanter.mongodb) (use 'somnium.congomongo) (mongo! :db "mydb") (view (fetch-dataset :cars)) Reading data read a comma-delimited file
  • 20. (use '(incanter core io)) (read-dataset "./data/cars.csv" :header true) (read-dataset "./data/cars.tdd" :header true :delim tab) (read-dataset "http://bit.ly/aZyjKa" :header true) (use 'incanter.datasets) (get-dataset :cars) (use 'incanter.mongodb) (use 'somnium.congomongo) (mongo! :db "mydb") (view (fetch-dataset :cars)) Reading data read a tab-delimited file
  • 21. (use '(incanter core io)) (read-dataset "./data/cars.csv" :header true) (read-dataset "./data/cars.tdd" :header true :delim tab) (read-dataset "http://bit.ly/aZyjKa" :header true) (use 'incanter.datasets) (get-dataset :cars) (use 'incanter.mongodb) (use 'somnium.congomongo) (mongo! :db "mydb") (view (fetch-dataset :cars)) Reading data read a comma-delimited file from a URL
  • 22. (use '(incanter core io)) (read-dataset "./data/cars.csv" :header true) (read-dataset "./data/cars.tdd" :header true :delim tab) (read-dataset "http://bit.ly/aZyjKa" :header true) (use 'incanter.datasets) (get-dataset :cars) (use 'incanter.mongodb) (use 'somnium.congomongo) (mongo! :db "mydb") (view (fetch-dataset :cars)) Reading data read a built-in sample dataset
  • 23. (use '(incanter core io)) (read-dataset "./data/cars.csv" :header true) (read-dataset "./data/cars.tdd" :header true :delim tab) (read-dataset "http://bit.ly/aZyjKa" :header true) (use 'incanter.datasets) (get-dataset :cars) (use 'incanter.mongodb) (use 'somnium.congomongo) (mongo! :db "mydb") (view (fetch-dataset :cars)) Reading data retrieve a dataset from MongoDB
  • 24. (use '(incanter core io)) (save data "./data.csv") (use '(incanter core mongodb)) (use 'somnium.congomongo) (mongo! :db "mydb") (insert-dataset :cars data) Saving data save a dataset in a CSV file
  • 25. Saving data save a dataset in a MongoDB database (use '(incanter core io)) (save data "./data.csv") (use '(incanter core mongodb)) (use 'somnium.congomongo) (mongo! :db "mydb") (insert-dataset :cars data)
  • 26. (use '(incanter core datasets)) ($ :speed (get-dataset :cars)) (4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25) (with-data (get-dataset :cars) [(mean ($ :speed)) (sd ($ :speed))]) (with-data (get-dataset :iris) (view $data) (view ($ [:Sepal.Length :Sepal.Width :Species]))) Column selection select a single column
  • 27. (use '(incanter core datasets)) ($ :speed (get-dataset :cars)) (4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25) (with-data (get-dataset :cars) [(mean ($ :speed)) (sd ($ :speed))]) [15.4 5.29] (with-data (get-dataset :iris) (view $data) (view ($ [:Sepal.Length :Sepal.Width :Species]))) Column selection use with-data macro to bind dataset
  • 28. (use '(incanter core datasets)) ($ :speed (get-dataset :cars)) (4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25) (with-data (get-dataset :cars) [(mean ($ :speed)) (sd ($ :speed))]) [15.4 5.29] (with-data (get-dataset :iris) (view $data) (view ($ [:Sepal.Length :Sepal.Width :Species]))) Column selection view dataset bound to $data
  • 29. (use '(incanter core datasets)) ($ :speed (get-dataset :cars)) (4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25) (with-data (get-dataset :cars) [(mean ($ :speed)) (sd ($ :speed))]) [15.4 5.29] (with-data (get-dataset :iris) (view $data) (view ($ [:Sepal.Length :Sepal.Width :Species]))) Column selection select multiple columns
  • 30. (use '(incanter core datasets)) ($where {"Species" "setosa"} (get-dataset :iris)) ($where {"Petal.Width" {:lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5} "Species" {:in #{"virginica" "setosa"}}} (get-dataset :iris)) ($where (fn [row] (or (< (row "Petal.Width") 1.0) (> (row "Petal.Length") 5.0))) (get-dataset :iris)) Row selection select rows where species equals ‘setosa’
  • 31. (use '(incanter core datasets)) ($where {"Species" "setosa"} (get-dataset :iris)) ($where {"Petal.Width" {:lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5} "Species" {:in #{"virginica" "setosa"}}} (get-dataset :iris)) ($where (fn [row] (or (< (row "Petal.Width") 1.0) (> (row "Petal.Length") 5.0))) (get-dataset :iris)) Row selection select rows where petal-width < 1.5
  • 32. (use '(incanter core datasets)) ($where {"Species" "setosa"} (get-dataset :iris)) ($where {"Petal.Width" {:lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5} "Species" {:in #{"virginica" "setosa"}}} (get-dataset :iris)) ($where (fn [row] (or (< (row "Petal.Width") 1.0) (> (row "Petal.Length") 5.0))) (get-dataset :iris)) Row selection select rows where 1.0 < petal-width < 1.5
  • 33. (use '(incanter core datasets)) ($where {"Species" "setosa"} (get-dataset :iris)) ($where {"Petal.Width" {:lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5} "Species" {:in #{"virginica" "setosa"}}} (get-dataset :iris)) ($where (fn [row] (or (< (row "Petal.Width") 1.0) (> (row "Petal.Length") 5.0))) (get-dataset :iris)) Row selection select rows where species is ‘virginica’ or ‘setosa’
  • 34. (use '(incanter core datasets)) ($where {"Species" "setosa"} (get-dataset :iris)) ($where {"Petal.Width" {:lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5}} (get-dataset :iris)) ($where {"Petal.Width" {:gt 1.0, :lt 1.5} "Species" {:in #{"virginica" "setosa"}}} (get-dataset :iris)) ($where (fn [row] (or (< (row "Petal.Width") 1.0) (> (row "Petal.Length") 5.0))) (get-dataset :iris)) Row selection select rows using an arbitrary predicate function
  • 35. Sorting data hair & eye color data (use '(incanter core datasets)) (with-data (get-dataset :hair-eye-color) (view $data) (view ($order :count :desc)) (view ($order [:hair :eye] :desc)))
  • 36. Sorting data sort by count in descending order (use '(incanter core datasets)) (with-data (get-dataset :hair-eye-color) (view $data) (view ($order :count :desc)) (view ($order [:hair :eye] :desc)))
  • 37. Sorting data sort by hair and then eye color (use '(incanter core datasets)) (with-data (get-dataset :hair-eye-color) (view $data) (view ($order :count :desc)) (view ($order [:hair :eye] :desc)))
  • 38. Rolling up data mean petal-length by species (use '(incanter core datasets stats)) (->> (get-dataset :iris) ($rollup mean :Petal.Length :Species) view) (->> (get-dataset :iris) ($rollup #(/ (sd %) (count %)) :Petal.Length :Species) view) (->> (get-dataset :hair-eye-color) ($rollup sum :count [:hair :eye]) ($order :count :desc) view)
  • 39. Rolling up data standard error of petal-length (use '(incanter core datasets stats)) (->> (get-dataset :iris) ($rollup mean :Petal.Length :Species) view) (->> (get-dataset :iris) ($rollup #(/ (sd %) (count %)) :Petal.Length :Species) view) (->> (get-dataset :hair-eye-color) ($rollup sum :count [:hair :eye]) ($order :count :desc) view)
  • 40. Rolling up data sum of people with each hair/eye color combination (use '(incanter core datasets stats)) (->> (get-dataset :iris) ($rollup mean :Petal.Length :Species) view) (->> (get-dataset :iris) ($rollup #(/ (sd %) (count %)) :Petal.Length :Species) view) (->> (get-dataset :hair-eye-color) ($rollup sum :count [:hair :eye]) ($order :count :desc) view)
  • 41. Rolling up data sorted from most to least common (use '(incanter core datasets stats)) (->> (get-dataset :iris) ($rollup mean :Petal.Length :Species) view) (->> (get-dataset :iris) ($rollup #(/ (sd %) (count %)) :Petal.Length :Species) view) (->> (get-dataset :hair-eye-color) ($rollup sum :count [:hair :eye]) ($order :count :desc) view)
  • 42. Datasets •Creating •Reading data •Saving data •Column selection •Row selection •Sorting •Rolling up Overview •What is Incanter? •Getting started •Incanter libraries Charts •Scatter plots •Chart options •Saving charts •Adding data •Bar & line charts •XY & function plots •Histograms & box-plots •Annotating charts Wrap up Outline
  • 43. (view (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris))) Scatter plots plot ‘sepal length’ vs ‘sepal width’
  • 44. (view (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark)) use dark chart themeChart options
  • 45. (view (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark :group-by :Species)) group by species valuesChart options
  • 46. (view (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark :group-by :Species :title "Fisher Iris Data" :x-label "Sepal Length (cm)" :y-label "Sepal Width (cm)")) change chart title & axes labelsChart options
  • 47. (save (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark :group-by :Species :title "Fisher Iris Data" :x-label "Sepal Length (cm)" :y-label "Sepal Width (cm)") "./iris-plot.png") Saving charts save chart to a PNG file
  • 48. (def output-stream (java.io.ByteArrayOutputStream.)) (save (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark :group-by :Species :title "Fisher Iris Data" :x-label "Sepal Length (cm)" :y-label "Sepal Width (cm)") output-stream) save chart to an OutputStreamSaving charts
  • 49. (use 'incanter.pdf) (save-pdf (scatter-plot :Sepal.Length :Sepal.Width :data (get-dataset :iris) :theme :dark :group-by :Species :title "Fisher Iris Data" :x-label "Sepal Length (cm)" :y-label "Sepal Width (cm)") "./iris-plot.pdf") save chart to a PDF fileSaving charts
  • 50. (use '(incanter core charts datasets)) (with-data (get-dataset :iris) (doto (scatter-plot :Petal.Width :Petal.Length :theme :dark :data ($where {"Petal.Length" {:lte 2.0} "Petal.Width" {:lt 0.75}})) view))) Adding data plot points where petal-length <= 2 & petal-width < .75
  • 51. (use '(incanter core charts datasets)) (with-data (get-dataset :iris) (doto (scatter-plot :Petal.Width :Petal.Length :theme :dark :data ($where {"Petal.Length" {:lte 2.0} "Petal.Width" {:lt 0.75}})) (add-points :Petal.Width :Petal.Length :data ($where {"Petal.Length" {:gt 2.0} "Petal.Width" {:gte 0.75}})) view))) add points where petal-length > 2 & petal-width >= .75Adding data
  • 52. (use '(incanter core charts datasets stats)) (with-data (get-dataset :iris) (let [lm (linear-model ($ :Petal.Length) ($ :Petal.Width))] (doto (scatter-plot :Petal.Width :Petal.Length :theme :dark :data ($where {"Petal.Length" {:lte 2.0} "Petal.Width" {:lt 0.75}})) (add-points :Petal.Width :Petal.Length :data ($where {"Petal.Length" {:gt 2.0} "Petal.Width" {:gte 0.75}})) (add-lines :Petal.Width (:fitted lm)) view))) add a regression lineAdding data
  • 53. (use '(incanter core charts datasets)) (with-data ($rollup mean :Sepal.Length :Species (get-dataset :iris)) (view (bar-chart :Species :Sepal.Length :theme :dark))) Bar & line charts bar-chart of mean sepal-length for each species
  • 54. (use '(incanter core charts datasets)) (with-data ($rollup mean :Sepal.Length :Species (get-dataset :iris)) (view (line-chart :Species :Sepal.Length :theme :dark))) Bar & line charts line-chart of mean sepal-length for each species
  • 55. (with-data ($rollup :mean :count [:hair :eye] (get-dataset :hair-eye-color)) (view $data) (view (bar-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts rollup the :count column using mean
  • 56. (with-data ($rollup :mean :count [:hair :eye] (get-dataset :hair-eye-color)) (view $data) (view (bar-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts bar-chart grouped by eye color
  • 57. (with-data ($rollup :mean :count [:hair :eye] (get-dataset :hair-eye-color)) (view $data) (view (line-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts line-chart grouped by eye color
  • 58. (with-data (->> (get-dataset :hair-eye-color) ($where {:hair {:in #{"brown" "blond"}}}) ($rollup :sum :count [:hair :eye]) ($order :count :desc)) (view $data) (view (bar-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts sort by sum of :count column
  • 59. (with-data (->> (get-dataset :hair-eye-color) ($where {:hair {:in #{"brown" "blond"}}}) ($rollup :sum :count [:hair :eye]) ($order :count :desc)) (view $data) (view (bar-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts bar-chart grouped by eye color
  • 60. (with-data (->> (get-dataset :hair-eye-color) ($where {:hair {:in #{"brown" "blond"}}}) ($rollup :sum :count [:hair :eye]) ($order :count :desc)) (view $data) (view (line-chart :hair :count :group-by :eye :legend true :theme :dark))) Bar & line charts line-chart grouped by eye color
  • 61. xy-plot of two continuous variablesXY & function plots (use '(incanter (core charts))) (with-data (get-dataset :cars) (view (xy-plot :speed :dist :theme :dark)))
  • 62. function-plot of x3+2x2+2x+3XY & function plots (use '(incanter (core charts optimize))) (defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3)) (doto (function-plot cubic -10 10 :theme :dark) view)
  • 63. add the derivative of the functionXY & function plots (use '(incanter (core charts optimize))) (defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3)) (doto (function-plot cubic -10 10 :theme :dark) (add-function (derivative cubic) -10 10) view)
  • 64. add a sine waveXY & function plots (use '(incanter (core charts optimize))) (defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3)) (doto (function-plot cubic -10 10 :theme :dark) (add-function (derivative cubic) -10 10) (add-function #(* 1000 (sin %)) -10 10) view)
  • 65. plot a sample from a gamma distributionHistograms & box-plots (use '(incanter (core charts stats))) (doto (histogram (sample-gamma 1000) :density true :nbins 30 :theme :dark) view)
  • 66. add a gamma pdf lineHistograms & box-plots (use '(incanter (core charts stats))) (doto (histogram (sample-gamma 1000) :density true :nbins 30 :theme :dark) (add-function pdf-gamma 0 8) view)
  • 67. box-plots of petal-width grouped by speciesHistograms & box-plots (use '(incanter core datasets)) (with-data (get-dataset :iris) (view (box-plot :Petal.Width :group-by :Species :theme :dark)))
  • 68. plot sin waveAnnotating charts (use '(incanter core charts)) (doto (function-plot sin -10 10) view)
  • 69. add text annotation (black text only)Annotating charts (use '(incanter core charts)) (doto (function-plot sin -10 10) (add-text 0 0 "text at (0,0)") view)
  • 70. add pointer annotationsAnnotating charts (use '(incanter core charts)) (doto (function-plot sin -10 10) (add-text 0 0 "text at (0,0)") (add-pointer (- Math/PI) (sin (- Math/PI)) :text "pointer at (sin -pi)") (add-pointer Math/PI (sin Math/PI) :text "pointer at(sin pi)" :angle :ne) (add-pointer (* 1/2 Math/PI) (sin (* 1/2 Math/PI)) :text "pointer at(sin pi/2)" :angle :south) view)
  • 71. Datasets •Creating •Reading data •Saving data •Column selection •Row selection •Sorting •Rolling up Overview •What is Incanter? •Getting started •Incanter libraries Charts •Scatter plots •Chart options •Saving charts •Adding data •Bar & line charts •XY & function plots •Histograms & box-plots •Annotating charts Wrap up Outline
  • 72. learn more and contributeWrap up Learn more •Visit http://incanter.org •Visit http://data-sorcery.org Join the community and contribute •Join the Google group: http://groups.google.com/group/incanter •Follow Incanter on Github: http://github.com/liebke/incanter •Follow @liebke on Twitter