Skip to content

Commit

Permalink
[viz] add ->uniform-domain-points & domain-bounds-* fns
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 15, 2015
1 parent c09cfaf commit 6f6e6ab
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions geom-viz/src/core.org
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- [[#linear][Linear]]
- [[#logarithmic][Logarithmic]]
- [[#lens-axis][Lens axis]]
- [[#domain-analysis-ops][Domain analysis ops]]
- [[#raw-values-to-domain-point-conversion][Raw values to domain point conversion]]
- [[#domain-bounds][Domain bounds]]
- [[#visualization-methods][Visualization methods]]
- [[#line-plot][Line plot]]
- [[#area-plot][Area plot]]
Expand Down Expand Up @@ -803,6 +806,44 @@ details.
(axis-common*))))
#+END_SRC

** Domain analysis ops
*** Raw values to domain point conversion

Most of the visualization methods in this module expect a seq of data
points in the format: =[domain-position value]=. The function
=->uniform-domain-points= is useful to convert a sequence of pure
values into a uniformly spaced data points along the full breadth of
the given domain:

#+BEGIN_SRC clojure :noweb-ref analysis
(defn ->uniform-domain-points
"Given a vector of domain bounds and a collection of data values
(without domain position), produces a lazy-seq of 2-element vectors
representing the values of the original coll uniformly spread over
the full domain range, with each of the form: [domain-pos value]."
[[d1 d2] values]
(map
(fn [t v] [(m/mix d1 d2 t) v])
(m/norm-range (dec (count values)))
values))
#+END_SRC

*** Domain bounds
#+BEGIN_SRC clojure :noweb-ref analysis
(def domain-bounds-x #(gu/axis-bounds 0 %))

(def domain-bounds-y #(gu/axis-bounds 1 %))

(def domain-bounds-z #(gu/axis-bounds 2 %))

(defn total-domain-bounds
[f & colls]
(transduce
(map f)
(completing (fn [[aa ab] [xa xb]] [(min aa xa) (max ab xb)]))
[m/INF+ m/INF-] colls))
#+END_SRC

** Visualization methods

This section defines the various layout/plotting methods, each with a
Expand Down Expand Up @@ -1270,6 +1311,7 @@ TBD
(:require
[thi.ng.geom.core :as g]
[thi.ng.geom.core.vector :as v]
[thi.ng.geom.core.utils :as gu]
[thi.ng.geom.svg.core :as svg]
[thi.ng.ndarray.core :as nd]
[thi.ng.ndarray.contours :as contours]
Expand All @@ -1282,6 +1324,8 @@ TBD

<<formatters>>

<<analysis>>

<<scale>>

<<axis>>
Expand Down

0 comments on commit 6f6e6ab

Please sign in to comment.