#!/usr/bin/env perl

use PGPLOT;
use POSIX;

pgbegin(0,'?',1,1);
pgscf(1);                # Set character font
pgslw(4);                # Set line width
pgsch(1.5);              # Set character height
$xdim=370; $ydim=435;
pgenv(0,$xdim+1,0,$ydim+1,0,1);
pglabel("X","Y","");
$loop=0; $i=0; $j=0;

open(FILE, "A_V.csv") || die "Cannot open input file.\n";
while(<FILE>){
    $j = $loop % $ydim;
    $i = int($loop/$ydim);
    if($_ < 1.0)
    {
        $_ = 1;
    }
#    $value[$i][$j]=$_;
    $value[$i][$j] =log10($value[$i][$j]);
#    print $i, " ", $j, " ", $value[$i][$j], "\n";
    $loop++;
}
close(FILE);

$tr[0]=0; $tr[1]=1; $tr[2]=0; $tr[3]=0; $tr[4]=0; $tr[5]=1;
pggray(\@value,$xdim,$ydim,1,$xdim,1,$ydim,19,15,\@tr);
pgwedg('RG',0.5,2.5,19,15,'');
pgend;
