Skip to content

Commit

Permalink
PolarLogView
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Jul 7, 2015
1 parent 2531304 commit 65bdc4a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pygal/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ def __call__(self, rhotheta):
class PolarThetaLogView(View):
"""Logarithmic polar projection"""

def __init__(self, width, height, box):
def __init__(self, width, height, box, aperture=pi / 3):
super(PolarThetaLogView, self).__init__(width, height, box)
self.aperture = aperture
if not hasattr(box, '_tmin') or not hasattr(box, '_tmax'):
raise Exception(
'Box must be set with set_polar_box for polar charts')
Expand All @@ -276,14 +277,14 @@ def __call__(self, rhotheta):
theta = self.box._tmin + (self.box._tmax - self.box._tmin) * (
log10(theta) - self.log10_tmin) / (
self.log10_tmax - self.log10_tmin)
aperture = pi / 3

if theta > self.box._tmax:
theta = (3 * pi - aperture / 2) / 2
theta = (3 * pi - self.aperture / 2) / 2
elif theta < self.box._tmin:
theta = (3 * pi + aperture / 2) / 2
theta = (3 * pi + self.aperture / 2) / 2
else:
start = 3 * pi / 2 + aperture / 2
theta = start + (2 * pi - aperture) * (
start = 3 * pi / 2 + self.aperture / 2
theta = start + (2 * pi - self.aperture) * (
theta - self.box._tmin) / (
self.box._tmax - self.box._tmin)

Expand Down

0 comments on commit 65bdc4a

Please sign in to comment.