Hi all, I have a very strange behavior with manual setting ticks:
yticks = list(zip(np.arange(NLINES), 'I'm a tick'))
Then I try to set them in options:
hv.Path().opts(yticks=yticks)
which results in an error
keys must be a string
When I copy & paste the content of yticks list
hv.Path().opts(yticks=[(0, 'I'm a tick'), (...)])
everything works fine. I guess either it’s a bug or I’m the bug with handling Python types…
Any help appreciated!
Bit confused here, this is not valid syntax:
yticks = list(zip(np.arange(NLINES), 'I'm a tick')
If you fix the quotes, you get this:
yticks = list(zip(np.arange(10), "I'm a tick"))
yticks
[(0, 'I'),
(1, "'"),
(2, 'm'),
(3, ' '),
(4, 'a'),
(5, ' '),
(6, 't'),
(7, 'i'),
(8, 'c'),
(9, 'k')]
That said I can reproduce your issue. The problem is that np.arange(10) returns numpy int types not regular int types. If you replace it with regular range
it all works fine: yticks = list(zip(range(NLINES), ['I'm a tick']*NLINES))
Perfect! Thanks for the correction, had it right in my code, but wrongly copied manually here… BTW, I do the zip because in m code I do not have a single string, but a list of strings instead of “I’m a tick”.