Incanter 1.5.2 (bugfix release)

I’ve just pushed the new release of Incanter to Clojars. This is mostly bugfix release that fixes several bugs, of different severity. There is also one enhancement – you can use logarithmic axes in charts. More information about fixed bugs and new functions is at changelog.

I want to thank all people who helped with new release by creating issues & sending pull requests!

Incanter 1.5.1: Bugfix release

The bugfix release of Incater was just pushed to Clojars.

It fixes 2 bugs – one nasty bug when functions called from transform-with were working on underlying data, modifying them, and 2nd – when 2-argument version solve thrown an error.

Incanter 1.5.0 has been released!

After long development, the new version of Incanter has been released to clojars. This version contains a lot of changes, including following:

  • For matrix operations the clatrix/jblas libraries are used – this should greatly improve performance (but you may need to install libgfortran3 package on Linux 64-bit. See jblas wiki for more information)
  • Interpolation functions were added to incanter-core module
  • You can save charts in SVG format by using the new incanter-svg module
  • The incanter-chart module was extended with support for scatter plots
  • Many bugfixes

Full list of changes could be found in changelog. There are 2 open issues that could affect your use of Incanter, please read about them in changelog. We’ll try to address them in the next release.

I want to say “Thank You!” to all people who provided new functionality, fixed the bugs, filed the issues, and participated in discussions in mailing list. Without you, this release simply didn’t happen!

The next steps in development will happen in direction of release 2.0, where the main change will be use of core.matrix library for all matrix operations.

Hammock Driven Development Cheat Sheet

This last weekend I re-watched Rich Hickey’s excellent (I would say awesome, but he would disapprove) clojure-conj talk on Hammock Driven Development, which I’ve summarized into this one page cheat sheet. The talk isn’t specific to Clojure, and the ideas can, and have, been applied to domains outside of programming. I recommend it for anybody working on solving novel problems in any domain.

An Illustrated guide to multi-core parallelism in Clojure

Here are my Clojure Conj slides, From Concurrency to Parallelism: an illustrated guide to multi-core parallelism in Clojure. The version of clojure.par I used isn’t publicly available yet, but I will be publishing it in my github repo (github.com/liebke/clojure) soon, and hopefully it will make its way to master in the not too distant future.

I just want to thank everybody at the Conj for making it such a spectacular event! I’m already looking forward to next year.

Incanter executables

For a long time I’ve wanted a simple, double-clickable executable for Incanter, and now thanks to Alan Dipert’s swingrepl library I have it.

I have made an executable jar file, called incanter.jar, that launches a swingrepl, that includes Incanter and all of its dependencies, when double-clicked or started with the following command

java -jar incanter.jar

Note: Make sure to save incanter.jar with the .jar extension to ensure it executes correctly.

I have also used Apple’s Jar Bundler and SkoobySoft’s DMG Packager to create a Mac OS X executable that’s downloadable as a dmg file, Incanter.dmg.

Finally, I used Launch4j to create the Windows executable file,
Incanter.exe.

To build incanter.jar from source, use script/package in the Incanter distribution on Github, or just use lein uberjar (lein will call the file incanter-standalone.jar, and will create a non-executable jar called incanter.jar).

Reading and writing Excel (xls) files with Incanter

I have just added David James Humphreys’ incanter-excel module to the Incanter distribution, providing basic capabilities for reading Microsoft Excel spreadsheets in as Incanter datasets and saving datasets back out as xls files.

I have posted a simple spreadsheet of Australian airline passenger data from the 1950s to the Incanter website for the following example. The read-xls function can read xls files given either a filename or URL, so you won’t need to download the file.

Start by loading the necessary libraries, including incanter.excel.

(use '(incanter core charts excel))

Next, we can use the with-data macro to bind a dataset converted from the above xls file, using the read-xls function, and then view it.

(with-data (read-xls "http://incanter.org/data/aus-airline-passengers.xls")
  (view $data)

The read-xls function takes an optional argument called :sheet that takes either the name or index of the worksheet from the xls file to read (in this case either “dataset” or 0) , it defaults to 0.

[NOTE: A current weakness of read-xls is that cells containing formulae, as opposed to actual data, are not imported (i.e. the cells remain empty).]

Finally, we’ll create a time-series plot of the data. However, the time-series-plot needs time in milliseconds, so we’ll first create a function that converts the date column from Java Date objects to milliseconds, and then view the plot.

  (let [to-millis (fn [dates] (map #(.getTime %) dates))] 
    (view (time-series-plot (to-millis ($ :date)) ($ :passengers)))))

Datasets can also be saved as Excel files using the save-xls function. The following example just reads in one of the sample datasets using incanter.datasets/get-dataset and then saves it as an xls file.

(save-xls (get-dataset :cars) "/tmp/cars.xls")

The incanter-excel module is now included in the Incanter distribution on Github, and is available as a separate dependency from the Clojars repository. The complete code from this example can be found here.