in reply to Re: matrix 'graphic' problem
in thread matrix 'graphic' problem

Because it's Perl, I think I may try another shot (semi-golf version):

use Imager; my ($n, $fac) = (40, 10); # 2D-SIZE, FACTOR TO IMAGE my $fn = shift || 'datafile.dat'; open my $fh, '<', $fn or die "$fn $!"; # OPEN FILE my $img = Imager->new(xsize=>$n*$fac, ysize=>$n*$fac, channels=>3); $img->box(filled=>1, color=>'#FFFFFF'); # BACKGROUND $img->box(color=>[($_->[2]/10)*25, $_->[2]*2.5, $_->[2] ], filled=>1, xmax=>($_->[0]+1)*$fac, ymax=>($_->[1]+1)*$fac, xmin=>$_->[0]*$fac, ymin=>$_->[1]*$fac) for map [split /\s+ +/], <$fh>; $img->write(file=>'my.jpg', jpegquality=>90) or die $img->errstr;

the 2D matrix storage is't really necessary, this can be handled in "mid-air" ...

Regards

mwa