Subject: | Imager::Plot : division by 0 in Axis.pm when all Y are equal |
Hi,
There is a division by 0 in Imager::Plot::Axis (line 130 and 449) when all Y are equal. This is pretty self-explantory if you read the code. For exemple, I worked around the code by overloading the make_yrange() function of Axis.pm :
---
$graph->{'AXIS'}{'make_yrange'} = sub {
$self = shift;
my @bbox = $self->data_bbox();
if ($bbox[2] == $bbox[3]) {
$min = $bbox[2] - 1;
$max = $bbox[2] + 1;
$self->{YgridNum} = 1;
} else {
$min = $bbox[2];
$max = $bbox[3];
}
$self->{YRANGE} = [$min, $max];
}
---
Thanks for your good code !