Mixing iTorch and gfx server for plotting with Torch


While working with torch, I often has issues to get interactive plots. I found torch Gnuplot`s wrappers a bit restrictive. Thus, I looked for other frameworks

On the one hand, iTorch  provides user-friendly and nice plotting abilities. It is based on the bokeh library.  One may draw a nice plot in a single line:

Yet, you need to use iTorch ebook to interactively plot your figures. Otherwise, you need to save the plot into a html file and refresh your browser. That is quite a pain.

On the other hand, there is the gfx project made by Clement Faraber. One may run a server that is going to display figures on a browser. Plots are stored in a repository and the server update a webpage upon creation/modification of files in this repository. That works pretty well! The API wraps some figures from nvd3 library. Yet , I thought that bokeh libraries were a bit better and easier to use.

So, should I use iTorch or gfx? Well, let take the best of the two worlds.

Ou goal is to get something like this:

That  will render something like thatiTorchAndGfx

First of all, you need to modify the following file: ~/.gfx.js/static
Add the following line

The goal is to load the bokeh javascript/css in your HTML page.

I am not a big fan of forking projects, therefore, I neither modify the iTorch code nor gfx code. In addition, I avoid copy/past as much as possible. Therefore I ended with a working but a bit crappy solution. That modify the settalble of Plot. It also parsed the xml twice, but it does the job.

One may choose to modify the iTorch html template (That is a far cleaner solution), but again, I dislike forking projects…

The code can be downloaded there:

2 Comments on “Mixing iTorch and gfx server for plotting with Torch

  1. Thanks for the hack. Question. You mention to add two lines in ~/gfx.js/static. But it is a directory and there are multiple files and folders in there. Could you please let me know in which file I need to add these two lines..

Leave a Reply to Ravi Cancel reply

Your email address will not be published.