Discussion:
[R] Hinton Diagram for a matrix of weights
Xavier Fernández i Marín
2011-12-07 16:45:00 UTC
Permalink
Hello,

Although I have used a general search engine, r-seek, and browsed CRAN for
contributed packages and R Gallery, I have not been able to find an
implementation of Hinton Diagrams for representing weighting matrices using
R.

Does anyone knows a way of plotting weighting matrices in R?

Thank you,
--
- Xavier -
Jim Lemon
2011-12-08 11:18:57 UTC
Permalink
Post by Xavier Fernández i Marín
Hello,
Although I have used a general search engine, r-seek, and browsed CRAN for
contributed packages and R Gallery, I have not been able to find an
implementation of Hinton Diagrams for representing weighting matrices using
R.
Does anyone knows a way of plotting weighting matrices in R?
Hi Xavier,
The Hinton diagram looks fairly close to an image plot, or the
color2D.matplot function. The difference is that the area of the squares
in the Hinton plot are proportional to some value rather than the color,
which indicates the sign of the value. If you have no luck finding this,
I think I could easily morph color2D.matplot into a Hinton diagram
function.

Jim
Xavier Fernández i Marín
2011-12-09 10:04:27 UTC
Permalink
Post by Jim Lemon
The Hinton diagram looks fairly close to an image plot, or the
color2D.matplot function. The difference is that the area of the squares
in the Hinton plot are proportional to some value rather than the color,
which indicates the sign of the value. If you have no luck finding this,
I think I could easily morph color2D.matplot into a Hinton diagram
function.
I have tried the color2D.matplot() function and it works fine for what I
need now (checking matrices for my own use). However, it would be great if
R can have Hinton diagrams, and color2D.matplot would probably be the best
way to start. So I will appreciate very much if you can morph it.

Probably the single line to change will be the calls to hexagon() and
rect(), which will need some tunning. I will be glad to try to help.

Best,
--
- Xavier -
Xavier Fernández i Marín
2011-12-28 16:28:35 UTC
Permalink
Post by Jim Lemon
Post by Xavier Fernández i Marín
Hello,
Although I have used a general search engine, r-seek, and browsed CRAN for
contributed packages and R Gallery, I have not been able to find an
implementation of Hinton Diagrams for representing weighting matrices using
R.
Does anyone knows a way of plotting weighting matrices in R?
Hi Xavier,
The Hinton diagram looks fairly close to an image plot, or the
color2D.matplot function. The difference is that the area of the squares
in the Hinton plot are proportional to some value rather than the color,
which indicates the sign of the value. If you have no luck finding this,
I think I could easily morph color2D.matplot into a Hinton diagram
function.
Just for future reference and searches, the Hinton diagram has been
implemented in the color2D.matplot function of the plotrix package.

Thank you Jim.
--
- Xavier -
Stephen Eglen
2012-02-08 19:48:07 UTC
Permalink
Post by Xavier Fernández i Marín
Post by Jim Lemon
Post by Xavier Fernández i Marín
Hello,
Although I have used a general search engine, r-seek, and browsed
CRAN for contributed packages and R Gallery, I have not been able
to find an implementation of Hinton Diagrams for representing
weighting matrices using R.
Does anyone knows a way of plotting weighting matrices in R?
Hi Xavier,
The Hinton diagram looks fairly close to an image plot, or the
color2D.matplot function. The difference is that the area of the squares
in the Hinton plot are proportional to some value rather than the color,
which indicates the sign of the value. If you have no luck finding this,
I think I could easily morph color2D.matplot into a Hinton diagram
function.
Just for future reference and searches, the Hinton diagram has been
implemented in the color2D.matplot function of the plotrix package.
Thank you Jim.
There is a great new book called 'Principles of Computational Modelling
in Neuroscience' which has some examples in R; in particular in chapter
10 you will find code for 'Hinton plots' (also known as Willshaw
Plots).

http://www.compneuroprinciples.org/code-examples/10

Stephen

Wet Bell Diver
2011-12-09 10:17:57 UTC
Permalink
Xavier,

Perhaps this would be of help, you could use it as a starting point:
http://www.cs.princeton.edu/~mimno/factor-analysis.R
This page provides a function for Hinton diagrams.

-Peter
Post by Xavier Fernández i Marín
Hello,
Although I have used a general search engine, r-seek, and browsed CRAN for
contributed packages and R Gallery, I have not been able to find an
implementation of Hinton Diagrams for representing weighting matrices using
R.
Does anyone knows a way of plotting weighting matrices in R?
Thank you,
Loading...