Hinton is a small Julia library for generating Hinton diagrams. It supports standard graphics formats such as PNG, SVG, and PDF, as well as generating diagrams in a terminal with Unicode and colour support.
To install Hinton and its dependencies, simply type the following into the Julia REPL:
Hinton diagrams are commonly used to analyse the relative values of matrices. The diagram consists of rectangles whose area corresponds to the magnitude of the given element. White/black rectangles correspond to positive/negative values respectively. This visualisation makes it possible to gain an intuition about the matrix structure at a glance.
To demonstrate, we will generate a random matrix and visualise it.
srand(0x4711) # Fix the random seed. w = eye(17, 17) + randn(17, 17)
First, we generate a terminal-friendly text-only version:
using Hinton println(hintontxt(w))
While the text-only version is good for quick analysis, it is hardly of "publication quality". Thus, there is also a vector graphics version that draws upon Compose:
using Hinton draw(SVG("example_vec.svg", 256px, 256px), hintonvec(w))
3 months ago