Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Oct 29, 2013
2 parents ba6dd67 + 18f48b7 commit eceded2
Show file tree
Hide file tree
Showing 29 changed files with 475 additions and 240 deletions.
26 changes: 26 additions & 0 deletions Changes.md
@@ -1,5 +1,31 @@
# What's new in Incanter #

## Changes for 1.5.4 ##

Made an error during deployment of 1.5.3, so 1.5.4 was released to fix this problem.
Don't use 1.5.3!

## Changes for 1.5.3 ##

### Bugfixes ###

* Issue 183: the `pow` & `atan2` functions weren't implemented for matrices & datasets.
* `read-dataset` now converts empty fields to `nil`, or user-supplied value (see Issue 182).
* Documentation improvements.

### Enhancements ###

* New functions in `incanter.charts`:
* `set-point-size` to control size of points on scatter plots.
* New functions in `incanter.core`:
* `rename-cols` allows to rename columns of dataset
* `replace-column` replaces data in column of dataset with new values
* `add-column` allows easier to add new column to dataset
* `add-derived-column` adds a column to a dataset that is a function of existing
columns
* `melt` implements part of functionality of R's `melt` function from `reshape`
package.

## Changes for 1.5.2 ##

### Bugfixes ###
Expand Down
2 changes: 1 addition & 1 deletion README.textile
Expand Up @@ -61,7 +61,7 @@ The online documentation for most Incanter functions contain usage examples. The

The <a href="http://www.amazon.com/gp/product/178216264X/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=178216264X&linkCode=as2&tag=statisprograw-20">Clojure Data Analysis Cookbook</a> (published by Packt Publishing) contains several chapters dedicated to Incanter, including work with datasets, charting, etc. You can read the <a href="https://github.com/liebke/incanter/blob/master/docs/9781782162643_Chapter%206.pdf?raw=true">sample chapter</a> that describes Incanter's datasets.

There is dedicated mailing list for discussions about Incater. It's hosted on <a href="http://groups.google.com/group/clojure">Google Groups</a>.
There is dedicated mailing list for discussions about Incater. It's hosted on <a href="http://groups.google.com/group/incanter">Google Groups</a>.

*More Incanter examples*

Expand Down
8 changes: 8 additions & 0 deletions data/missing_values.csv
@@ -0,0 +1,8 @@
Monster,HP,Attack,Speed,Special,Gold,EXP
Goblin,6,1,3,,2,4
Werewolf,24,5,2,Venom,8,16
Oublia,40,,2,Memory,18
Statue,45,8,,Gaze,0,40
,,
Dragon,85,10,20,Fire;Flying,120,35
Undefeatable,,50,20,Death,,
4 changes: 2 additions & 2 deletions modules/incanter-charts/project.clj
@@ -1,11 +1,11 @@
(defproject incanter/incanter-charts "1.5.2"
(defproject incanter/incanter-charts "1.5.5-SNAPSHOT"
:description "Incanter-charts is the JFreeChart module of the Incanter project."
:url "http://incanter.org/"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:scm {:name "git" :url "https://github.com/liebke/incanter"}
:min-lein-version "2.0.0"
:dependencies [[incanter/incanter-io "1.5.2"]
:dependencies [[incanter/incanter-io "1.5.5-SNAPSHOT"]
[incanter/jfreechart "1.0.13-no-gnujaxp"]
[clj-time "0.5.0" :exclusions [org.clojure/clojure]]]
)
45 changes: 31 additions & 14 deletions modules/incanter-charts/src/incanter/charts.clj
Expand Up @@ -1223,7 +1223,6 @@
chart))

(defmacro candle-stick-plot
[& options]
"Produces a candle stick chart
Options:
Expand All @@ -1236,17 +1235,17 @@
:open Key for accessing open value data (defaults to :open)
:close Key for accessing close value data (defaults to :close)
:volume Key for accessing volume data (defaults to :volume). Volume data is optional
:title (default 'Candle Chart Plot') main title
:title (default 'Candle Stick Plot') main title
:time-label (default empty)
:value-label (default empty)
:legend (default false) prints legend
:series-label (default empty)
Example:
(candle-plot :data <dataset>) ;; uses default mappings so the dataset must have :date, :high, :low, :open, :close and :volume keys
(candle-stick-plot :data <dataset>) ;; uses default mappings so the dataset must have :date, :high, :low, :open, :close and :volume keys
;; more customization
(candle-plot
(candle-stick-plot
:data dataset
:high :HighPrice
:low :LowPrice
Expand All @@ -1257,10 +1256,12 @@
:time-label \"CoB date\"
:value-label \"Price\"
:series-label \"Price time series\"
:title \"Price information\")"
:title \"Price information\")
"
[& options]
`(let [opts# ~(when options (apply assoc {} options))
main-title# (or (:title opts#) "Candle Chart Plot")
main-title# (or (:title opts#) "Candle Stick Plot")
args#
(concat
(mapcat #(vector % (or (opts# %) %)) [:volume :high :low :open :close :date])
Expand All @@ -1272,7 +1273,6 @@
:series-label (or (opts# :series-label))]))))]
(apply candle-stick-plot* args#)))


(defn time-series-plot* [x y & options]
(apply create-xy-series-plot x y create-time-series-plot options))

Expand All @@ -1286,7 +1286,7 @@
:data (default nil) If the :data option is provided a dataset,
column names can be used instead of sequences
of data as arguments to xy-plot.
:title (default 'Time Series Plot') main title
:title (default '') main title
:x-label (default x expression)
:y-label (default y expression)
:legend (default false) prints legend
Expand Down Expand Up @@ -1317,6 +1317,7 @@
`(let [opts# ~(when options (apply assoc {} options))
group-by# (:group-by opts#)
title# (or (:title opts#) "")
legend# (or (:legend opts#) false)
x-lab# (or (:x-label opts#) (str '~x))
y-lab# (or (:y-label opts#) (str '~y))
series-lab# (or (:series-label opts#) (if group-by#
Expand All @@ -1325,6 +1326,7 @@
args# (concat [~x ~y] (apply concat (seq (apply assoc opts#
[:group-by group-by#
:title title#
:legend legend#
:x-label x-lab#
:y-label y-lab#
:series-label series-lab#]))))]
Expand Down Expand Up @@ -1392,7 +1394,7 @@
to write it to a file.
Options:
:title (default 'Histogram') main title
:title (default '') main title
:x-label (default x expression)
:y-label (default 'Frequency')
:legend (default false) prints legend
Expand Down Expand Up @@ -1860,7 +1862,7 @@
values -- a sequence of numeric values
Options:
:title (default 'Histogram') main title
:title (default '') main title
:x-label (default 'Categories')
:y-label (default 'Value')
:legend (default false) prints legend
Expand Down Expand Up @@ -2000,7 +2002,7 @@
values -- a sequence of numeric values
Options:
:title (default 'Histogram') main title
:title (default '') main title
:x-label (default 'Categories')
:y-label (default 'Value')
:series-label
Expand Down Expand Up @@ -2517,7 +2519,7 @@
values -- a sequence of numeric values
Options:
:title (default 'Histogram') main title
:title (default '') main title
:legend (default false) prints legend
Expand Down Expand Up @@ -2607,7 +2609,7 @@
to write it to a file.
Options:
:title (default 'Histogram') main title
:title (default '') main title
:x-label (default x expression)
:y-label (default 'Frequency')
:legend (default false) prints legend
Expand Down Expand Up @@ -2685,7 +2687,7 @@
display the chart, or the 'save' function to write it to a file.
Options:
:title (default 'Histogram') main title
:title (default '') main title
:x-label (default x expression)
:y-label (default 'Frequency')
:legend (default false) prints legend
Expand Down Expand Up @@ -3641,6 +3643,21 @@
(.setSeriesPaint renderer series color)
chart)))

(defn set-point-size
"Set the point size of a scatter plot. Use series option to apply
point-size to only one series."
[chart point-size & {:keys [series dataset] :or {series :all dataset 0}}]
(let [xy (- (/ point-size 2))
new-point (java.awt.geom.Ellipse2D$Double. xy xy point-size point-size)
plot (.getPlot chart)
series-count (.getSeriesCount plot)
series-list (if (= :all series)
(range 0 series-count)
(list series))
renderer (.getRenderer plot dataset)]
(doseq [a-series series-list]
(doto renderer (.setSeriesShape a-series new-point)))
chart))

;;;; DEFAULT THEME METHODS

Expand Down
3 changes: 3 additions & 0 deletions modules/incanter-charts/test/incanter/charts_tests.clj
Expand Up @@ -218,6 +218,9 @@
(set-title plot1 "new title")
(set-x-label plot1 "new x label")
(set-y-label plot1 "new y label")
(set-point-size plot1 1 :series 0)
(set-point-size plot1 10 :series 1)
(set-point-size plot1 5)
(Thread/sleep wait-timeout)
(.dispose sw1)
(.dispose sw2)
Expand Down
2 changes: 1 addition & 1 deletion modules/incanter-core/project.clj
@@ -1,4 +1,4 @@
(defproject incanter/incanter-core "1.5.2"
(defproject incanter/incanter-core "1.5.5-SNAPSHOT"
:description "Incanter-core is the core module of the Incanter project."
:url "http://incanter.org/"
:license {:name "Eclipse Public License"
Expand Down

0 comments on commit eceded2

Please sign in to comment.