1.2.3-SNAPSHOT permalink Arrow_down_16x16

pie-chart

incanter.charts

  • (pie-chart categories values & options)
Returns a JFreeChart object representing a pie-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 'Histogram') main title
:legend (default false) prints legend


See also:
view and save

Examples:


(use '(incanter core stats charts datasets))

(view (pie-chart ["a" "b" "c"] [10 20 30]))

(view (pie-chart (sample "abcdefghij" :size 10 :replacement true)
(sample-uniform 10 :max 50) :legend true))


(with-data (->> (get-dataset :hair-eye-color)
($rollup :sum :count [:hair :eye]))
(view $data)
(view (pie-chart :hair :count :title "Hair Color"))
(view (pie-chart :eye :count :title "Eye Color")))



References:
http://www.jfree.org/jfreechart/api/javadoc/
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/JFreeChart.html

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/charts.clj:2018 top

(defmacro pie-chart
" Returns a JFreeChart object representing a pie-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 'Histogram') main title
    :legend (default false) prints legend
    

  See also:
    view and save

  Examples:


    (use '(incanter core stats charts datasets))

    (view (pie-chart [\"a\" \"b\" \"c\"] [10 20 30]))

     (view (pie-chart (sample \"abcdefghij\" :size 10 :replacement true)
                     (sample-uniform 10 :max 50) :legend true))


     (with-data (->> (get-dataset :hair-eye-color)
                     ($rollup :sum :count [:hair :eye]))
       (view $data)
       (view (pie-chart :hair :count :title \"Hair Color\"))
       (view (pie-chart :eye :count :title \"Eye Color\")))



  References:
    http://www.jfree.org/jfreechart/api/javadoc/
    http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/JFreeChart.html

"
  ([categories values & options]
    `(let [opts# ~(when options (apply assoc {} options))
	   main-title# (or (:title opts#) "")
	   args# (concat [~categories ~values] 
			 (apply concat (seq (apply assoc opts# 
						   [:main-title main-title#]))))]
        (apply pie-chart* args#))))
Vars in incanter.charts/pie-chart: apply assoc defmacro when concat let list or seq vector
Used in 0 other vars

Comments top

No comments for pie-chart. Log in to add a comment.