Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a ticks input parameter #8

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

Add a ticks input parameter #8

kwgoodman opened this issue Jul 24, 2010 · 0 comments
Labels

Comments

@kwgoodman
Copy link
Contributor

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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant