feature: custom axis labeling from kernel side (tick_labels). #1526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows any custom labeling from the kernel side, and code reuse of labeling code for bqplot and matplotlib.
While I think it's always good to have more scales, there is always a use case of not being able to let the scales+axis do what you want.
Using
tick_values
was already useful, but in combination with the newtick_labels
(dict that maps values to labels) users have ultimate freedom to position and format the ticks on that axis.Listening to min and max on the scales, we can update the ticks when we pan (no code example for that yet).
e.g.:
We can use that for matplotlib (code by @astrofrog ):
And also use that in bqplot (yes, react-ipywidget code 😛 )
Giving:
See also the notebook example, where I added roman numbering: