Angharad has asked for the wisdom of the Perl Monks concerning the following question:
If one imagines the first two columns as 'objects' the third column is a measure of similarity between those two objects. I want to create a 2D grid as an image (.png/.ps file or similar) - it will probably be about 40 squares by 40 squares in size. I would like the measure of similarity between the two objects to be highlighted as a specific colour and the objects to become the 'x' 'y' co-ordinates of the matrix. Any pointers in the right direction would be appreciated.1 1 20 1 2 45 1 3 46 2 1 45 etc ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matrix 'graphic' problem
by zentara (Cardinal) on Oct 15, 2007 at 20:32 UTC | |
I'm not really a human, but I play one on earth. Cogito ergo sum a bum | [reply] [d/l] |
|
Re: matrix 'graphic' problem
by samtregar (Abbot) on Oct 15, 2007 at 17:31 UTC | |
Given just what you've asked, I'd say you should take a look at Imager (or possible Image::Magick or GD, although I much prefer Imager). You can easily create an image with colored boxes for your coordinates using that library. -sam | [reply] |
|
Re: matrix 'graphic' problem
by mwah (Hermit) on Oct 15, 2007 at 19:30 UTC | |
If one imagines the first two columns as 'objects' the third column is a measure of similarity between those two objects. I want to create a 2D grid as an image (.png/.ps file or similar) As has been said already, map the values on an array and map this array to an arbitary graphic output, like:
(This is my first shot at Imager - after sams remark - and therefore the reason that I posted this, so feel free to give hints ...) Regards mwa Modification #1:
| [reply] [d/l] |
by mwah (Hermit) on Oct 15, 2007 at 20:34 UTC | |
Because it's Perl, I think I may try another shot (semi-golf version):
the 2D matrix storage is't really necessary, this can be handled in "mid-air" ... Regards mwa | [reply] [d/l] |
|
Re: matrix 'graphic' problem
by dwm042 (Priest) on Oct 15, 2007 at 18:25 UTC | |
Update: A pure Perl graphing solution is GD::Graph, and a tutorial for this software is available here. | [reply] |