diff --git a/pygal/graph/base.py b/pygal/graph/base.py index 4cd193e..be44496 100644 --- a/pygal/graph/base.py +++ b/pygal/graph/base.py @@ -52,9 +52,10 @@ class BaseGraph(object): self.view = None if self.logarithmic and self.zero == 0: # Explicit min to avoid interpolation dependency - self.zero = min(filter( + positive_values = filter( lambda x: x > 0, - [val for serie in self.series for val in serie.safe_values])) + [val for serie in self.series for val in serie.safe_values]) + self.zero = min(positive_values) if positive_values else 0 self._draw() self.svg.pre_render() diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index ee20cb2..6eda135 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -198,6 +198,7 @@ class Graph(BaseGraph): )) x = -5 y = self.view.y(position) + if not y: continue if draw_axes: self.svg.node( guides, 'path', diff --git a/pygal/view.py b/pygal/view.py index 67e6a1c..d41ce8f 100644 --- a/pygal/view.py +++ b/pygal/view.py @@ -293,8 +293,8 @@ class LogView(View): self.width = width self.height = height self.box = box - self.log10_ymax = log10(self.box.ymax) - self.log10_ymin = log10(self.box.ymin) + self.log10_ymax = log10(self.box.ymax) if self.box.ymax > 0 else 0 + self.log10_ymin = log10(self.box.ymin) if self.box.ymin > 0 else 0 self.box.fix(False) # pylint: enable-msg=W0231