-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add support for custom scatter markers #14165
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
Conversation
Just noting this exact ask came up on the Discourse recently: https://discourse.bokeh.org/t/custom-markers-extensions-and-registering-new-marker-types/12089/2 |
I had imagined this with a dedicated I do think passing the defs to individual custom_markers = {"@foo": ..., "@bar": ...}
Scatter.register(custom_markers)
plot.scatter(x, y, marker="@foo")
plot.scatter(x, y, marker="@bar") I'm sure there are other possibilities, e.g. decorator or something. |
86fe872
to
d8328c1
Compare
I'm considering adding
If there's only one |
Yup I expected that to be the main little roadblock. It's something that could have been useful in other contexts though so using this as a motivating use-case might be worthwhile. |
Technically we already have something quite similar to this for |
8ff1898
to
d07ce80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simulating positional args seems a bit unconventional in TypeScript. FWIW I think splitting into apply
and apply_for_path
or something similar would also be reasonable.
This is standard practice in JavaScript, thus it's standard practice TypeScript. TypeScript covers existing patterns in JavaScript and it isn't (as much as possible) opinionated about chosen patterns. This also follows the canvas API. I would typically split such API into multiple methods if signatures were too complex and/or there were run-time performance implications of a unified API. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR allows to define custom scatter markers using
Scatter(defs={"@new_name": CustomJS(...)})
. Custom marker names are prefixed with@
, so that they can be differentiated easily (and on the type level) from built-in markers.From
examples/basic/scatters/custom_markers.py
: