#!/usr/bin/perl use Image::Magick; $xsize = 400; $ysize = 400; $image = Image::Magick->new('size'=>"${xsize}x${ysize}"); $image->ReadImage('xc:white'); $cabase = 1000; $clbase = 35; foreach $x (1..$xsize){ $mlevel = int( ($x/$xsize) * 110 ); $mlevel = 1 if ($mlevel < 1); foreach $y (1..$ysize){ $mdef = int( ($y/$ysize) * 3000 ); #100 * AR / (AR + DR) * 2 * alvl / (alvl + dlvl) $cth = 100 * ( $cabase / ($cabase + $mdef) ) * 2 * ( $clbase / ($clbase + $mlevel) ); # caps $cth = 5 if ($cth < 5); $cth = 95 if ($cth > 95); # reference band $cth = 0 if ($cth >45 && $cth < 55); # add marks at approx every 30th level and 1000th def point $cth = 0 if ($mdef % 1000 < 20); $cth = 0 if ($mlevel % 30 < 2); # make the graph more readable by dividing it up in to 10% chunks $cth = 0 unless ($cth % 10); $scth = int(($cth / 100) * 255); $hcth = sprintf("%lx",$scth); $r = $image->Set("pixel[" . ($x - 1) . "," . ($y - 1) . "]" => "#${hcth}0000"); warn "$r" if $r; } } $r = $image->Write('doi.gif'); warn "$r" if $r;