Skip to content

Commit

Permalink
Merge pull request matplotlib#2036 from mdboom/inverted-log-axis
Browse files Browse the repository at this point in the history
Fix missing ticks on inverted log axis
  • Loading branch information
mdboom committed May 21, 2013
2 parents b02b701 + 90c1aa3 commit bcf4df6
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 146 deletions.
14 changes: 9 additions & 5 deletions lib/matplotlib/axis.py
Expand Up @@ -991,10 +991,13 @@ def _update_ticks(self, renderer):
interval_expanded = interval[1], interval[0]

if hasattr(self, '_get_pixel_distance_along_axis'):
# normally, one does not want to catch all exceptions that could possibly happen, but it
# is not clear exactly what exceptions might arise from a user's projection (their rendition
# of the Axis object). So, we catch all, with the idea that one would rather potentially
# lose a tick from one side of the axis or another, rather than see a stack trace.
# normally, one does not want to catch all exceptions that
# could possibly happen, but it is not clear exactly what
# exceptions might arise from a user's projection (their
# rendition of the Axis object). So, we catch all, with
# the idea that one would rather potentially lose a tick
# from one side of the axis or another, rather than see a
# stack trace.
try:
ds1 = self._get_pixel_distance_along_axis(interval_expanded[0], -0.5)
except:
Expand All @@ -1005,7 +1008,8 @@ def _update_ticks(self, renderer):
except:
warnings.warn("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed.")
ds2 = 0.0
interval_expanded = (interval[0] - ds1, interval[1] + ds2)
interval_expanded = (interval_expanded[0] - ds1,
interval_expanded[1] + ds2)

ticks_to_draw = []
for tick, loc, label in tick_tups:
Expand Down
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/log_scales.pdf
Binary file not shown.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/log_scales.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bcf4df6

Please sign in to comment.