Skip to content
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

Open
jamestwebber opened this issue Sep 12, 2022 · 8 comments
Open

Feature request: customizable controls #38

jamestwebber opened this issue Sep 12, 2022 · 8 comments

Comments

@jamestwebber
Copy link

(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!

@flekschas
Copy link
Owner

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
@jamestwebber
Copy link
Author

I wasn't suggesting to remove it entirely, just that being able to customize the controls for the widget would be a nice feature.

@flekschas
Copy link
Owner

I see, thanks for clarifying.

For customization, you can use ipywidgets. For instance, the scatter.show() method is merely a helper to link some jupyter-scatter functionality to buttons using ipywidgets. But you can easily create your own toolbar or customizations with ipywidgets.

@jamestwebber
Copy link
Author

Would you accept a PR for this, or are you not interested?

@flekschas
Copy link
Owner

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. :)

@flekschas-ozette
Copy link

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?

@jamestwebber
Copy link
Author

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 widget.py, but less clear how to do that via options in the Scatter interface. I'm not that familiar with how widgets work.

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.

@flekschas
Copy link
Owner

Thanks for the example and the pointer to bokeh. I think the tools should be part of the show() method instead of the Scatter class as show() defines the buttons. Unfortunately, I can't give you any timeline when I would get to this. If you feel strongly about this feature and have the time, please feel free to take a stab at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants