Skip to content

display real or complex matrices using Hinton diagrams in Matlab or Octave

License

Notifications You must be signed in to change notification settings

dezanche/Hinton_plot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hinton Diagram

The function Hinton_plot.m works in Matlab or Octave to display a real or complex matrix using a Hinton diagram (original idea published here). At each position in the matrix the marker area is proportional to the absolute value of the matrix element, which allows a wide range of values to be displayed and readily interpreted. If the matrix is real and positive, the colour of all markers is the same. If not, the phase of each element modifies the colour of the corresponding marker. The advantages of Hinton diagrams over traditional colour-mapped display (e.g., imagesc) are:

  • differences in magnitude of the matrix elements are more readily interpreted from the size of the markers as opposed to colour or grayscale differences
  • if complex, the phase is also visualized (as a colour), which is impossible with traditional display

Examples shown below include 8x8 noise correlation and covariance matrices which are often used in MR image reconstruction from coil arrays. Similar functionality is available in R's corrplot and in Python's matplotlib.
I hope you find this useful.

Usage

Hinton_plot(A);
Hinton_plot(A,marker);
S = Hinton_plot(A,marker);

Where:

  • A is the matrix to be displayed.
  • marker (optional) specifies the marker type similarly to other graphical commands like plot. The default marker is a circle.

The function returns a handle (S) to a scatter object.

Examples

50x50 random matrix (real)

A=2*rand(50)-1;
s=Hinton_plot(A,'s');
set(s,'markeredgecolor','k')

50x50 random real matrix

100x100 random matrix (complex)

100x100 random complex matrix

Correlation absolute value

Using square markers ('s'): With imagesc only magnitude can be displayed:
abs correlation abs correlation imagesc

Complex covariance

Notice how differences in variance (along the diagonal) are readily identified and Hermitian symmetry is verified by looking at the phase colours.
Markers are default circles ('o').
complex covariance

Covariance absolute value

Using diamonds ('d'):
abs covariance abs covariance imagesc

Contributors

Nicola De Zanche

Licenses

Software code is licensed under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
CClicense
All other original content in this repository (including this README file) is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.

About

display real or complex matrices using Hinton diagrams in Matlab or Octave

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages