Open btracey opened 6 years ago
We should not allow ±Inf or NaN bounds on creation. They make even less sense here than they do in the floats span functions. What were the parameters used in creating the heat map?
In this case, just the default. I had a -inf
value in my grid and didn't realize it. This problem, though, isn't manifested until attempting to save the plot. I would suggest that NewHeatMap
return (heat, err)
giving an error for things like the (effective) data bounds are inf or NaN
SGTM
While calling plot.Save
The problem is that the calculation on heat.go171 is
fmt.Println(int((v-h.Min)*ps + 0.5))
. Whenh.Min = -inf
, thenps = 0
, which means the calculation isNaN
, and the interpreted integer is a very negative integer which panics on the bound.I'm not sure what the fix is, Scatter et. al. have errors returned in creation, maybe this should be the case as well? Or maybe the non-inf min should be calculated to allow default special casing.