use PDL; use PDL::Graphics::Simple; use PDL::Graphics::ColorSpace; sub as_heatmap { my ($d) = @_; my $max = $d->max; die "as_heatmap: can't work if max == 0" if $max == 0; $d /= $max; # negative OK my $hue = (1 - $d)*240; $d = cat($hue, pdl(1), pdl(1)); (hsv_to_rgb($d->mv(-1,0)) * 255)->byte->mv(0,-1); } imag as_heatmap(rvals 300,300);
In reply to Heatmap in PDL by etj
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |