Plotting with Torch7
Plotting is a key element for scientific computations. However, Lua/Torch does not provide a unified framework for plotting figures. Instead, several Lua/Torch libraries coexist. Each of them wraps a underlying plotting libraries such as gnuplot or bokeh. Therefore, they all have their strengths and weaknesses. It is time consuming to try them all. In this post, I try to list the most interesting API to provide some pros/cons to help you make your choice.
PS Because of some WP update, plots are not well-displayed. I am working on it.
Before looking for a plotting library, one should first answer the following questions:
- Do you “only” need to visualize the picture?
- Do you need to store the raw data inside the picture?
- Do you need to interact with the plot? Zooming, retrieving values, highlight some points etc.
Beware the more advanced features you need, the dirtier your hands would be. On the other side, no-one wants to loose his time on technical details to plot a cosinus. Therefore, it is worth to know what is the final goal!
Upon time, plotting libraries has evolved and two strategies co-exist to display charts.
- Plots are displayed inside an application/windows.
- Plots are displayed on a web-browser by using a local server.
Eventually, some libraries does not natively support Torch format, aka, torch.Tensor. To be honest, that is not a big deal!
Applicative Libraries vs Server-based Libraries
Most plotting software/APIs often rely on a desktop environment. For instance, plotting a figure in Matlab or R will open a new windows. Those API are also often specialized with a single language; it is not possible to directly plot R data with Matlab. On the other side, this enables some optimizations for plotting workflow is fully integrated. Some command-line graphing application were created to be agnostic to a programming language. Yet, they can quickly become a bit verbose! In both cases, it can also become troublesome if you want to remotely monitor your graph (Which can be very useful with Deep Learning!)
Therefore, a plotting API “only” needs to implements the server protocol for the graphical part is handled by the browser. There is also no need to wrap every single plotting functions. This architecture is quite flexible and allows highly-personalized plots.
Actually, most of Torch plotting API are based on this server/client architecture. No worries, you do not have to be web expert to use such plotting libraries! Most of the time, you only need to execute a script to start the server and to type the URL localhost:8000 in your browser. Then, you need to use standard API that would forward your data to the server!
Let’s have a look to the available library!