@@ -62,9 +62,10 @@ func main() {
62
62
63
63
// Find bounding rectangle for points to get around the normalization done by the heatmap library
64
64
r2Bounds := r2 .RectFromPoints (points ... )
65
+ padding := float64 (dotSize ) / 2.0 // Calculating padding amount to avoid shrinkage by the heatmap library
65
66
bounds := image.Rectangle {
66
- Min : image.Point {X : int (r2Bounds .X .Lo ), Y : int (r2Bounds .Y .Lo )},
67
- Max : image.Point {X : int (r2Bounds .X .Hi ), Y : int (r2Bounds .Y .Hi )},
67
+ Min : image.Point {X : int (r2Bounds .X .Lo - padding ), Y : int (r2Bounds .Y .Lo - padding )},
68
+ Max : image.Point {X : int (r2Bounds .X .Hi + padding ), Y : int (r2Bounds .Y .Hi + padding )},
68
69
}
69
70
70
71
// Transform r2.Points into heatmap.DataPoints
@@ -86,11 +87,11 @@ func main() {
86
87
87
88
// Create output canvas and use map overview image as base
88
89
img := image .NewRGBA (imgMap .Bounds ())
89
- draw .Draw (img , imgMap .Bounds (), imgMap , image .ZP , draw .Over )
90
+ draw .Draw (img , imgMap .Bounds (), imgMap , image.Point {} , draw .Over )
90
91
91
92
// Generate and draw heatmap overlay on top of the overview
92
93
imgHeatmap := heatmap .Heatmap (image .Rect (0 , 0 , bounds .Dx (), bounds .Dy ()), data , dotSize , opacity , schemes .AlphaFire )
93
- draw .Draw (img , bounds , imgHeatmap , image .ZP , draw .Over )
94
+ draw .Draw (img , bounds , imgHeatmap , image.Point {} , draw .Over )
94
95
95
96
// Write to stdout
96
97
err = jpeg .Encode (os .Stdout , img , & jpeg.Options {Quality : jpegQuality })
0 commit comments