Database Reference
In-Depth Information
Getting ready
We'll use the same dependencies in our project.clj ile as we did in Creating scatter plots
with Incanter .
We'll use this set of imports in our script or REPL:
(require '[incanter.core :as i]
'[incanter.charts :as c]
'incanter.datasets)
(import org.jfree.chart.renderer.category.LayeredBarRenderer
org.jfree.util.SortOrder)
We'll use the Iris dataset again. Here's how to load it in Incanter:
(def iris (incanter.datasets/get-dataset :iris))
How to do it...
For this recipe, we'll create a bar chart with multiple columns, one for each measurement
column in the Iris dataset:
1. We'll irst create the bar chart and add a category for each measurement:
(def iris-dimensions
(i/with-data
iris
(doto (c/bar-chart :Species :Petal.Width
:title "iris' dimensions"
:x-label "species"
:y-label "cm"
:series-label "petal width"
:legend true)
(c/add-categories
:Species :Sepal.Width
:series-label "sepal width")
(c/add-categories
:Species :Petal.Length
:series-label "petal length")
(c/add-categories
:Species :Sepal.Length
:series-label "sepal length"))))
 
Search WWH ::




Custom Search