Returns a JFreeChart object representing an area-chart of the given data.
Use the 'view' function to display the chart, or the 'save' function
to write it to a file.
Arguments:
categories -- a sequence of categories
values -- a sequence of numeric values
Options:
:title (default '') main title
:x-label (default 'Categories')
:y-label (default 'Value')
:series-label
:legend (default false) prints legend
:vertical (default true) the orientation of the plot
:group-by (default nil) -- a vector of values used to group the values into
series within each category.
See also:
view and save
Examples:
(use '(incanter core stats charts datasets))
(with-data (get-dataset :co2)
(view (area-chart :Type :uptake
:title "CO2 Uptake"
:group-by :Treatment
:x-label "Grass Types" :y-label "Uptake"
:legend true)))
(def data (get-dataset :airline-passengers))
(view (area-chart :year :passengers :group-by :month :legend true :data data))
(with-data (get-dataset :airline-passengers)
(view (area-chart :month :passengers :group-by :year :legend true)))
(def data (get-dataset :austres))
(view data)
(def plot (area-chart :year :population :group-by :quarter :legend true :data data))
(view plot)
(save plot "/tmp/austres_plot.png" :width 1000)
(view "file:///tmp/austres_plot.png")
(def seasons (mapcat identity (repeat 3 ["winter" "spring" "summer" "fall"])))
(def years (mapcat identity (repeat 4 [2007 2008 2009])))
(def values (sample-uniform 12 :integers true :max 100))
(view (area-chart years values :group-by seasons :legend true))
(view (area-chart ["a" "b" "c"] [10 20 30]))
(view (area-chart ["a" "a" "b" "b" "c" "c" ] [10 20 30 10 40 20]
:legend true
:group-by ["I" "II" "I" "II" "I" "II"]))
;; add a series label
(def plot (area-chart ["a" "b" "c"] [10 20 30] :legend true :series-label "s1"))
(view plot)
(add-categories plot ["a" "b" "c"] [5 25 40] :series-label "s2")
(view (area-chart (sample "abcdefghij" :size 10 :replacement true)
(sample-uniform 10 :max 50) :legend true))
References:
http://www.jfree.org/jfreechart/api/javadoc/
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/JFreeChart.html
Comments top
No comments for area-chart. Log in to add a comment.