This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-16
Channels
- # beginners (11)
- # boot (21)
- # cider (12)
- # clara (6)
- # cljs-dev (7)
- # cljsjs (1)
- # cljsrn (62)
- # clojure (137)
- # clojure-austin (5)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-russia (46)
- # clojure-spec (21)
- # clojure-uk (79)
- # clojurescript (56)
- # clr (1)
- # core-typed (1)
- # css (1)
- # cursive (3)
- # datomic (35)
- # docker (2)
- # emacs (20)
- # garden (3)
- # hoplon (8)
- # incanter (3)
- # jobs (12)
- # mount (5)
- # nginx (1)
- # off-topic (71)
- # om (8)
- # om-next (6)
- # onyx (4)
- # perun (3)
- # proton (2)
- # protorepl (5)
- # re-frame (35)
- # reagent (38)
- # ring (5)
- # ring-swagger (12)
- # rum (35)
- # spacemacs (2)
- # specter (5)
- # test-check (6)
- # yada (52)
Does anyone know how to add a shaded polygon to a plot? Ideally, I'd just like to shade an area under my function.
Seems like you can set the fill paint via the ctor http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/annotations/XYPolygonAnnotation.html#XYPolygonAnnotation-double:A-java.awt.Stroke-java.awt.Paint-java.awt.Paint- but not in Clojure wrapper function: https://github.com/incanter/incanter/blob/master/modules/incanter-charts/src/incanter/charts.clj#L3232
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))