jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.15k stars 949 forks source link

Scaled sliders - convergence with bqplot and altair #1153

Open SylvainCorlay opened 7 years ago

SylvainCorlay commented 7 years ago

The convergence of altair, bqplot and Jupyter interactive widgets

A quick unordered list of issues that seem unrelated at first but will all come together nicely with this proposal

Proposal

SylvainCorlay commented 7 years ago

cc @ellisonbg @jasongrout @maartenbreddels @jakevdp

This is still being edited.

dmadeka commented 7 years ago

cc @ssunkara1 @dmadeka @rmenegaux @ccherukuri? People that might be affected - i.e. the core bqplot team?

maartenbreddels commented 7 years ago

πŸ‘ good timing, I'm at the stage where I am about to add ticks to ipyvolume, and I will use d3 for that, so I'll be ready to adapt to using future scales. This would make linking bqplot axes, ipyvolume axes, and sliders possible, I like the proposal. Even starting out with just linear scales will help, that's I guess 80% of the use cases.

jdemeyer commented 7 years ago

He proposed that instead of having separate IntSlider and FloatSlider, we adopt trait types that map to PEP 3141, the type hierarchy for numbers.

For the record: this is not what I proposed. I simply proposed that IntSlider and FloatSlider should be part of some common base class, say NumericSlider, but I never said that this should relate to PEP 3141. I do want sliders which work for any numeric type and I don't see how PEP 3141 could help with that.

jdemeyer commented 7 years ago

See #721 for that discussion.

SylvainCorlay commented 7 years ago

The PEP 3141 was mentioned in another discussion with you about our use of isinstance #236. There was also your PR about using the collections ABC in #722.

ellisonbg commented 7 years ago

Thanks for getting this started...

The lack of solid scale implementations in Python is a huge issue that keeps showing up all over the place:

The thing that I think would be most useful:

Using widgets alone for this won't work as there are multiple Python libraries (Pandas, Matplotlib) that need Python scales and don't ever know about JS. Doing this would mostly involve porting the ds scales to Python...

Cheers, Brian

jdemeyer commented 7 years ago

The PEP 3141 was mentioned in another discussion with you about our use of isinstance #236. There was also your PR about using the collections ABC in #722.

Right, but I never proposed to use the numbers ABC (PEP 3141) for sliders. So I would appreciate it if you fix the issue description :-)

Would this proposal affect SelectionSlider in any way?

SylvainCorlay commented 7 years ago

The PEP 3141 was mentioned in another discussion with you about our use of isinstance #236. There was also your PR about using the collections ABC in #722.

Right, but I never proposed to use the numbers ABC (PEP 3141) for sliders. So I would appreciate it if you fix the issue description :-)

OK, since you taught me about type ABCs, I mixed the two issues (collections and numbers). I edited the description. There was no intention of misrepresenting what you have said.

So regarding the selection slider, this could be based on a d3 ordinal scale.

SylvainCorlay commented 7 years ago

The thing that I think would be most useful:

  • A fully declarative set of scales.
  • A Pure Python (traitlets) implementation of those scales.
  • A Pure Python implementation of those scales that are widgets and sync to JS.

For a pure backend implmentation of scales, we will probably need a formal spec, otherwise, we will end up having inconsistencies between the different implementations.

jasongrout commented 7 years ago

This is related to #1134.

vidartf commented 7 years ago

I've made a very humble beginning for this in https://github.com/vidartf/ipyscales. Any and all input is welcome πŸ‘