Returns a JFreeChart object representing the histogram of the given data.
Use the 'view' function to display the chart, or the 'save' function
to write it to a file.
Options:
:nbins (default 10) number of bins
:density (default false) if false, plots frequency, otherwise density
:title (default 'Histogram') main title
:x-label (default x expression)
:y-label (default 'Frequency')
:legend (default false) prints legend
:series-label (default x expression)
See also:
view, save, add-histogram
Examples:
(use '(incanter core charts stats))
(view (histogram (sample-normal 1000)))
# plot a density histogram
(def hist (histogram (sample-normal 1000) :density true))
(view hist)
# add a normal density line to the plot
(def x (range -4 4 0.01))
(add-lines hist x (pdf-normal x))
# plot some gamma data
(def gam-hist (histogram (sample-gamma 1000) :density true :nbins 30))
(view gam-hist)
(def x (range 0 8 0.01))
(add-lines gam-hist x (pdf-gamma x))
(use 'incanter.datasets)
(def iris (get-dataset :iris))
(view (histogram :Sepal.Width :data iris))
(with-data (get-dataset :iris)
(view (histogram :Petal.Length)))
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 histogram. Log in to add a comment.