Plots points on the given scatter-plot or xy-plot of the (x,y) points.
Equivalent to R's lines function, returns the modified chart object.
Options:
:series-label (default x expression)
Examples:
(use '(incanter core stats io datasets charts))
(def cars (to-matrix (get-dataset :cars)))
(def y (sel cars :cols 0))
(def x (sel cars :cols 1))
;; add regression line to scatter plot
(def lm1 (linear-model y x))
;; model the data without an intercept
(def lm2 (linear-model y x :intercept false))
(doto (xy-plot x (:fitted lm1) :legend true)
view
(add-points x y)
(add-lines x (:fitted lm2)))
(with-data (get-dataset :iris)
(doto (scatter-plot :Sepal.Length :Sepal.Width :data ($where {:Species "setosa"}))
(add-points :Sepal.Length :Sepal.Width :data ($where {:Species "versicolor"}))
(add-points :Sepal.Length :Sepal.Width :data ($where {:Species "virginica"}))
view))
;; of course this chart can be achieved in a single line:
(view (scatter-plot :Sepal.Length :Sepal.Width :group-by :Species :data (get-dataset :iris)))
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 add-points. Log in to add a comment.