Skip to content

Commit

Permalink
Only apply cyclic formatter for cylindrical projections
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 31, 2016
1 parent c7d962b commit 13a8473
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions holocube/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def _set_axis_ticks(self, axis, ticks, log=False, rotation=0):
if an integer number of ticks is supplied and setting a
rotation for the ticks.
"""
cylindrical = isinstance(axis.axes.projection,
crs._CylindricalProjection)
if axis.axis_name == 'x':
set_fn = axis.axes.set_xticks
low, high = axis.axes.get_xlim()
Expand All @@ -82,11 +84,12 @@ def _set_axis_ticks(self, axis, ticks, log=False, rotation=0):
axis.set_major_locator(ticks)
elif not ticks and ticks is not None:
axis.set_ticks([])
elif isinstance(ticks, int):
axis.set_major_formatter(formatter)
elif isinstance(ticks, int) and cylindrical:
if cylindrical:
axis.set_major_formatter(formatter)
ticks = list(np.linspace(low, high, ticks))
set_fn(ticks, crs=crs.PlateCarree())
elif isinstance(ticks, (list, tuple)):
elif isinstance(ticks, (list, tuple)) and cylindrical:
labels = None
if all(isinstance(t, tuple) for t in ticks):
ticks, labels = zip(*ticks)
Expand Down

0 comments on commit 13a8473

Please sign in to comment.