use PDL; use PDL::Graphics::TriD; #Color Mandelbrot animation nokeeptwiddling3d(); $a=zeroes 300,300;$r=$a->xlinvals(-1.5,0.5); $i=$a->ylinvals(-1,1); $t=$r;$u=$i; for(1..30){$q=$r**2-$i**2+$t; $h = 2*$r*$i+$u; $d=$r**2+$i**2; $a=lclip($a,$_*($d>2.0)*($a==0)); ($r,$i) = map{$_->clip(-5,5)}$q,$h; imagrgb[($a==0)*($r/2+0.75),($a==0)*($i+1)/2,$a/30]}; # [press 'q' in the graphics window when done] keeptwiddling3d(); twiddle3d(); #### use PDL; use PDL::Graphics2D; #imports imag2d() and twiddle() use PDL::Graphics::PGPLOT::Window; use PDL::Graphics::PGPLOT; my $winopt = {Device => "/GW", WindowWidth => 7, Aspect => 1}; #my $w = PDL::Graphics2D->new($winopt); my $w = PDL::Graphics::PGPLOT::Window->new($winopt); $a = sequence(64,48,3); # make test RGB image $a = $a->mv(2,0); # color must be dim(0) with size [0..4] $a /= $a->max; # pixel values in [0.0,1.0] $a = sin(10*$a); $w = imag2d($a);