Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add a ticks input parameter #8

Open
kwgoodman opened this Issue Jul 24, 2010 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

kwgoodman commented Jul 24, 2010

What do you think of adding a ticks parameter to DataArray?

Current behavior:

>>> dar = DataArray([[1, 2], [3, 4]], (('row', ['A','B']), ('col', ['C', 'D'])))
>>> dar.axes
(Axis(label='row', index=0, ticks=['A', 'B']),
 Axis(label='col', index=1, ticks=['C', 'D']))

Proposed ticks as separate input parameter:

>>> DataArray([[1, 2], [3, 4]], labels=('row', 'col'), ticks=[['A', 'B'], ['C', 'D']])

I think this would make it easier for new users to construct a DataArray with
ticks just from looking at the DataArray signature. No magic tuples needed. It would match the
signature of Axis. My use case is to use ticks only and not names axes (at
first), so:
::
>>> DataArray([[1, 2], [3, 4]], ticks=[['A', 'B'], ['C', 'D']])

instead of the current:
::
>>> DataArray([[1, 2], [3, 4]], ((None, ['A','B']), (None, ['C', 'D'])))

It might also cause less typos (parentheses matching) at the command line.

Having separate labels and ticks input parameters would also leave the option
open to allow any hashable object, like a tuple, to be used as a label.
Currently tuples have a special meaning, the (labels, ticks) tuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment