Skip to content

Commit

Permalink
Correct docstring and ensure PEP8 compliance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Riel committed May 4, 2014
1 parent 42b085c commit ff3f0d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mpltools/special/hinton.py
Expand Up @@ -6,6 +6,7 @@

__all__ = ['hinton']


# TOOD: Add yutils.mpl._coll to mpltools and use that for square collection.
class SquareCollection(collections.RegularPolyCollection):
"""Return a collection of squares."""
Expand Down Expand Up @@ -45,8 +46,8 @@ def hinton(inarray, max_value=None, use_default_ticks=True):
max_value : float
Any *absolute* value larger than `max_value` will be represented by a
unit square.
ticklabels : array
Array of strings to use as label. Length should match inarray.
use_default_ticks: boolean
Disable tick-generation and generate them outside this function.
"""

ax = plt.gca()
Expand Down Expand Up @@ -79,6 +80,7 @@ def hinton(inarray, max_value=None, use_default_ticks=True):
ax.xaxis.set_major_locator(IndexLocator())
ax.yaxis.set_major_locator(IndexLocator())


class IndexLocator(ticker.Locator):

def __init__(self, max_ticks=10):
Expand All @@ -91,4 +93,4 @@ def __call__(self):
step = 1
else:
step = np.ceil(dmax / self.max_ticks)
return self.raise_if_exceeds(np.arange(0, dmax, step))
return self.raise_if_exceeds(np.arange(0, dmax, step))

0 comments on commit ff3f0d0

Please sign in to comment.