use PDL; use PDL::Graphics::PGPLOT; #my $win1 = dev('/GW', {Aspect => 1, WindowWidth => 7}); $x = xlinvals(zeroes(100,100), -5, 5); $y = ylinvals(zeroes(100,100), -5, 5); $z = sin($x*$y/2); imag $z; hold; #Show the partial derivatives wrt. x & y as vectors $xcomp = $x*cos($x*$y/2)/2; $ycomp = $y*cos($x*$y/2)/2; #We want to show only every sixth vector for clarity $s = '0:-1:10,0:-1:10'; #Finally we need to map the final 10x10 array to the 100x100 image $tr = pdl(0,10,0,0,0,10); vect $xcomp->slice($s), $ycomp->slice($s), {Transform=>$tr};