-
Notifications
You must be signed in to change notification settings - Fork 17
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
[Feature Request] Text Overlays #73
Comments
I think this would be a super useful feature and it should definitely be feasible. I think the two big questions are around the API design and the best way to implement this. API DesignRegarding the API design, I think a natural/fitting way to approach this could be a new function called scatter.label(by="name", color="black", outline="white", size=16, max_labels=50, importance="score") If the And in the case that Technical ImplementationThis will be interesting. Ideally, the text is rendered with WebGL as well but implementing this from scratch will be tough. CandyGraph did a really good job here. Maybe we can take inspiration. Alternatively, I wonder, if we could use the Canvas API. It's slower than WebGL but offers more flexibility when it comes to rendering text and is easy to work with. And assuming we'll limit the number of labels to |
I was actually looking at Deck.gl for their TextLayer as inspiration, particularly the ability to layer text over top of the scatterplot with potentially independent xy positioning for the the text. Their CollisionFilter extension applied to text is particularly appealing but well beyond my capacity to implement. If I was going to implement anything I think it would be something simple very much cribbed from the text label example in regl-scatterplot, assuming I am interpreting how that works correctly. That wouldn't be WebGL, but should suffice as long as you don't want to many labels on screen at a time, which should be manageable. I may try and take a go at this in a few weeks if I get some time. Thanks for the encouragement. |
Wow, the collision filter seems to work really great! The biggest question is how well deck.gl integrates with regl-scatterplot and how much it depends on geospatial data. Just looking at the view state of the basic examples (https://deck.gl/docs/get-started/using-standalone#using-deckglcore) makes it seem like everything is based on long/lat, which is not really how regl-scatterplot works. There might be a way to integrate the two libraries but it might require a bit of a hack to translate between regl-scatterplot's camera view matrix into the long/lat/zoom view state of deck.gl |
The ability to overlay text layers for labelling / annotation would be very useful. Some examples include in ThisNotThat (see the plot at the bottom of this page) or Atlas from Nomic eg this example. Looking through the regl-scatterplot examples it looks like this is relatively tractable. Some questions remain as to the exact API that would work well.
Javascript is not a language I know well, but I would be willing to try and get a version working and try to make a PR if you feel like this would be a useful addition. I'm also happy to discuss options on what the API/options exposed on the python end should be.
The text was updated successfully, but these errors were encountered: