|
|
|
@ -150,7 +150,7 @@ class PolarView(View):
|
|
|
|
|
(rho * cos(theta), rho * sin(theta))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YLogView(View): |
|
|
|
|
class LogView(View): |
|
|
|
|
"""Logarithmic projection """ |
|
|
|
|
# Do not want to call the parent here |
|
|
|
|
# pylint: disable-msg=W0231 |
|
|
|
@ -158,8 +158,6 @@ class YLogView(View):
|
|
|
|
|
self.width = width |
|
|
|
|
self.height = height |
|
|
|
|
self.box = box |
|
|
|
|
self.ymin = self.box.ymin |
|
|
|
|
self.ymax = self.box.ymax |
|
|
|
|
self.log10_ymax = log10(self.box.ymax) |
|
|
|
|
self.log10_ymin = log10(self.box.ymin) |
|
|
|
|
self.box.fix(False) |
|
|
|
@ -182,8 +180,6 @@ class XLogView(View):
|
|
|
|
|
self.width = width |
|
|
|
|
self.height = height |
|
|
|
|
self.box = box |
|
|
|
|
self.xmin = self.box.xmin |
|
|
|
|
self.xmax = self.box.xmax |
|
|
|
|
self.log10_xmax = log10(self.box.xmax) |
|
|
|
|
self.log10_xmin = log10(self.box.xmin) |
|
|
|
|
self.box.fix(False) |
|
|
|
@ -193,22 +189,48 @@ class XLogView(View):
|
|
|
|
|
"""Project x""" |
|
|
|
|
if x is None or x <= 0 or self.log10_xmax - self.log10_xmin == 0: |
|
|
|
|
return None |
|
|
|
|
return (self.width - self.width * |
|
|
|
|
return (self.width * |
|
|
|
|
(log10(x) - self.log10_xmin) |
|
|
|
|
/ (self.log10_xmax - self.log10_xmin)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class XYLogView(XLogView, YLogView): |
|
|
|
|
class XYLogView(XLogView, LogView): |
|
|
|
|
def __init__(self, width, height, box): |
|
|
|
|
self.width = width |
|
|
|
|
self.height = height |
|
|
|
|
self.box = box |
|
|
|
|
self.xmin = self.box.xmin |
|
|
|
|
self.xmax = self.box.xmax |
|
|
|
|
self.ymin = self.box.ymin |
|
|
|
|
self.ymax = self.box.ymax |
|
|
|
|
self.log10_ymax = log10(self.box.ymax) |
|
|
|
|
self.log10_ymin = log10(self.box.ymin) |
|
|
|
|
self.log10_xmax = log10(self.box.xmax) |
|
|
|
|
self.log10_xmin = log10(self.box.xmin) |
|
|
|
|
self.box.fix(False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HorizontalLogView(XLogView): |
|
|
|
|
"""Logarithmic projection """ |
|
|
|
|
# Do not want to call the parent here |
|
|
|
|
# pylint: disable-msg=W0231 |
|
|
|
|
def __init__(self, width, height, box): |
|
|
|
|
self._force_vertical = None |
|
|
|
|
self.width = width |
|
|
|
|
self.height = height |
|
|
|
|
self.box = box |
|
|
|
|
self.log10_xmax = log10(self.box.ymax) |
|
|
|
|
self.log10_xmin = log10(self.box.ymin) |
|
|
|
|
self.box.fix(False) |
|
|
|
|
self.box.swap() |
|
|
|
|
|
|
|
|
|
def x(self, x): |
|
|
|
|
"""Project x""" |
|
|
|
|
if x is None: |
|
|
|
|
return None |
|
|
|
|
if self._force_vertical: |
|
|
|
|
return super(HorizontalLogView, self).x(x) |
|
|
|
|
return super(XLogView, self).y(x) |
|
|
|
|
|
|
|
|
|
def y(self, y): |
|
|
|
|
if y is None: |
|
|
|
|
return None |
|
|
|
|
if self._force_vertical: |
|
|
|
|
return super(XLogView, self).y(y) |
|
|
|
|
return super(HorizontalLogView, self).x(y) |
|
|
|
|