Fork me on GitHub
#incanter
<
2017-01-16
>
kenny23:01:33

Does anyone know how to add a shaded polygon to a plot? Ideally, I'd just like to shade an area under my function.

kenny23:01:57

For those interested, I ended up writing my own version of add-polygon:

(defn add-polygon
  [chart coords & options]
  (let [{:keys [stroke outline-paint fill-paint]
         :or   {stroke        (BasicStroke. 1.0)
                outline-paint Color/BLACK
                fill-paint    nil}} (when options (apply assoc {} options))
        points (double-array (mapcat identity coords))
        anno (XYPolygonAnnotation. points stroke outline-paint fill-paint)]
    (.addAnnotation (.getPlot chart) anno)
    chart))