1.2.3-SNAPSHOT permalink Arrow_down_16x16

add-histogram

incanter.charts

  • (add-histogram chart x & options)

Adds a histogram to an existing histogram plot, returns the modified
chart object.

Options:
:nbins (default 10) number of bins for histogram
:series-label (default x expression)

Examples:

(use '(incanter core charts stats datasets))
(doto (histogram (sample-normal 1000)
:legend true)
view
(add-histogram (sample-normal 1000 :sd 0.5)))


(with-data (get-dataset :iris)
(doto (histogram :Sepal.Length :legend true)
(add-histogram :Petal.Length)
view))

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:295 top

(defmacro add-histogram
"
  Adds a histogram to an existing histogram plot, returns the modified
  chart object.

  Options:
    :nbins (default 10) number of bins for histogram
    :series-label (default x expression)

  Examples:

    (use '(incanter core charts stats datasets))
    (doto (histogram (sample-normal 1000)
                     :legend true)
          view
          (add-histogram (sample-normal 1000 :sd 0.5)))


    (with-data (get-dataset :iris)
      (doto (histogram :Sepal.Length :legend true)
        (add-histogram :Petal.Length)
        view))

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

"
  ([chart x & options]
    `(let [opts# ~(when options (apply assoc {} options))
           series-lab# (or (:series-label opts#) (str '~x))
           args# (concat [~chart ~x] 
			 (apply concat (seq (apply assoc opts# 
						   [:series-label series-lab#]))))]
        (apply add-histogram* args#))))
Vars in incanter.charts/add-histogram: apply assoc defmacro when concat let list or seq str vector
Used in 0 other vars

Comments top

No comments for add-histogram. Log in to add a comment.