-
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: customizable controls #38
Comments
Are you suggesting to simply remove the rotation tool? It might not be useful to you but then nobody really forces you to use it and removing the button does not really save any space. If you just want the widget without the controls, you can do the following: scatter = jscatter.Scatter(data=df, x='mass', y='speed')
scatter.widget |
I wasn't suggesting to remove it entirely, just that being able to customize the controls for the widget would be a nice feature. |
I see, thanks for clarifying. For customization, you can use ipywidgets. For instance, the |
Would you accept a PR for this, or are you not interested? |
It depends on the scope/functionality you're thinking of. At the moment, I am not entirely sure what kind of customization you're having in mind. If it's about hiding/showing pre-defined buttons I am not entirely sure it's worth the effort. If it's about creating new custom buttons, I'm simply a bit hesitant as I don't want to replicate functionality that is already provided by ipywidgets. Having said all that, maybe you can provide a example of how you envision one would customize the buttons and how it helps the user. I might simply miss the use case and might be convinced that it's a good idea to allow customizing the buttons. :) |
Hey @jamestwebber, are you still interested in providing an example for how you'd like to extend jupter-scatter or did you find a way to customize the UI by linking ipywidgets? |
Hey! I just got distracted with a bunch of other stuff. I did take a look at the code a few weeks ago. It's simple to modify the code to remove specific controls in The interface I'd prefer would be something like scatter = Scatter(x=x, y=y) # normal controls
scatter2 = Scatter(x=x, y=y, tools="pan,wheel_zoom,lasso_select,reset") # just those four Which is similar to how Bokeh configures widgets. I had been trying to build something like this with Bokeh but it seemed like jupyter-scatter does what I need and potentially has improved performance. |
Thanks for the example and the pointer to bokeh. I think the tools should be part of the |
I just came here with the same question, so I figured I'd share the ipywidget rearranging code that I'm using to get rid of / rearrange the preset buttons. import pandas as pd
import numpy as np
import jscatter
from ipywidgets import HBox, VBox, GridBox
def jscatter_button_customize(widget_box, buttons_to_show):
button_order = ['panZoom', 'lasso', 'border_line', 'camera', 'download', 'refresh']
button_box = widget_box.children[0]
assert len(button_box.children) == len(button_order)
new_children = [button_box.children[button_order.index(button)] for button in buttons_to_show]
return HBox([VBox(new_children, layout=button_box.layout), widget_box.children[1]])
def jscatter_composed_button_customize(widget_box, buttons_to_show):
new_scatters = [jscatter_button_customize(scatter, buttons_to_show) for scatter in widget_box.children]
return GridBox(new_scatters, layout=widget_box.layout)
d = pd.DataFrame({'x': np.random.random(size=200), 'y': np.random.random(size=200), 'z': np.random.random(size=200)})
# example usage for a single plot
# rearranging buttons and only showing some
scatter = jscatter.Scatter(data=d, x='x', y='y')
jscatter_button_customize(scatter.show(), ['download', 'border_line', 'panZoom', 'lasso'])
# example usage for a grid of plots
# again rearranging buttons and only showing some
scatter2 = jscatter.Scatter(data=d, x='x', y='z')
a_gridbox = jscatter.compose([scatter, scatter2], sync_selection=True, sync_hover=True)
jscatter_composed_button_customize(a_gridbox, ['download', 'border_line', 'panZoom', 'lasso']) This is fine for my purposes for now. I'd be happy to add some code to put these kinds of options in Scatter.show() and pass the arguments through compose if you think it is useful, though I might need a little hand holding on the github collaboration workflow, which I don't have experience with. Thanks for making an awesome tool! |
Thanks for sharing the code! ❤️ I'm not against a PR but I'm still not quite sure what the use case for this feature is. For an end user, I don't see much value as Jupyter Scatter only offers a total of five buttons so hide one or two buttons isn't going to save any space. Rearranging buttons might be useful to a power user but then again you can do all interactions with just the mouse so I'm not even sure a power user would save much time. For an application developer who wants to use Jupyter Scatter in their app/widget, they can just simply use Don't get me wrong, more features always sounds cool :) But more features also means more maintenance. And I currently fail to see how this features is worth that. That's why it's not high up on my priority list. But maybe I'm just not seeing the use case or why this feature would be helpful. I'm happy to be convinced otherwise :) |
This makes sense. I like the less-features-philosophy, and the children-rearranging or custom buttons thing will definitely work for me :) |
* feat: add fullscreen support This PR also implements #38 * fix: typo * fix: properly alpha blend when saving a view as PNG * fix: allow exporting an upscaled image * docs: fix docstring of `scatter.show()` * fix: ensure inputs and select adhere to Jupyter Widgets styles * docs: describe advanced exporting * docs: document `scatter.show()` * chore: update vitepress * fix: pass `buttons` on to `scatter.widget.show()` * test: fix camera fixed test * docs: mention full-screen mode addition
(or maybe this is possible and I was just unable to find it)
In the applications I'm interested in the "rotation" tool is not really necessary, and I find it a little confusing in how it treats the axis ticks (they seem to change in some strange, not-data-based way). So it would be preferable to disable that tool from the interactive widget.
From reading the code I think this would be fairly simple, just an additional option that changes how
mouse_mode_widget
is created?Thanks for developing this tool, it is very cool!
The text was updated successfully, but these errors were encountered: