<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Construct a heatmap with perl]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/33843/construct-a-heatmap-with-perl?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/33843/construct-a-heatmap-with-perl?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/33843/construct-a-heatmap-with-perl</guid>
	<pubDate>Fri, 07 Jul 2017 04:35:13 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/33843/construct-a-heatmap-with-perl</link>
	<title><![CDATA[Construct a heatmap with perl]]></title>
	<description><![CDATA[<code>#!/bin/env perl
use strict;
use warnings;

use Imager::Heatmap;

my $hmap = Imager::Heatmap-&gt;new(
    xsize  =&gt; 640,        # Image width
    ysize  =&gt; 480,        # Image height
    xsigma =&gt; 10,         # Sigma value of X-direction
    ysigma =&gt; 10,         # Sigma value of Y-direction
);

# @point_datas should be: ( [ x1, y1, weight1 ], [ x2, y2, weight2 ] ... )
my @point_datas = ( [ 10, 20, 50 ], [ 20, 40, 70 ] );

# Add point datas to construct density matrix
$hmap-&gt;insert_datas(@point_datas); 

# After adding datas, get heatmap as Imager instance.
my $img = $hmap-&gt;draw;

# create png file in current directory
$img-&gt;write( file =&gt; &#039;./hm.png&#039; );</code>]]></description>
	<dc:creator>Neel</dc:creator>
</item>

</channel>
</rss>