Skip to content

Commit

Permalink
Much simpler method of determining axis direction
Browse files Browse the repository at this point in the history
  • Loading branch information
nippoo committed Jun 2, 2015
1 parent f0b9c51 commit fbfcc41
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions vispy/visuals/axis.py
Expand Up @@ -43,17 +43,9 @@ def draw_ticks(self, transforms):

def _get_tick_direction(self):
"""Determines the tick direction if not specified."""

v = self.vec

right = np.array([1, 0])
up = np.array([0, -1])

# This will be negative if the axis is pointing upwards,
# and positive if right.
rightness = np.linalg.norm(v*right)-np.linalg.norm(v*up)

if np.sign(rightness) >= 0:
if abs(v[0]) >= abs(v[1]):
v = np.dot(np.array([[0, -1], [1, 0]]), v) # right axis, down ticks
else:
v = np.dot(np.array([[0, 1], [-1, 0]]), v) # up axis, left ticks
Expand Down

0 comments on commit fbfcc41

Please sign in to comment.