On Sep 16, 2015, at 9:05 AM, Lien Michiels <[email protected]> wrote:
Thanks for your answer! I've been trying to get it to work the way you described, but I experienced two problems with this approach:
ColumnDataSource will only accept arguments of size > 1, while alpha (at least for the line glyph) seems to be a single value.
If I replace it by an array of alphas, it seems to have no effect. The code will run but not do anything.
I guess you could say I'm trying to establish a proof of concept, that these kinds of web apps that usually require either a lot of work on the JS side, or an expensive tool like Shiny can be built using Notebooks and Bokeh, both OpenSource. So that is just not an option in this case ;-).
Do you have any more ideas?
Op dinsdag 15 september 2015 19:45:11 UTC+2 schreef Nick Roth:
No immediate solution, but wanted to mention two things.
Have you referenced the example here for interacting using ipython notebooks? http://bokeh.pydata.org/en/latest/docs/user_guide/notebook.html#integrating-ipython-interactors
I believe the solution would be to think of it as you must create an object representing the things you want to toggle on/off, then you would change the attribute associated with them via the column data source. So, you aren't redrawing the whole thing, you are updating the values in the columns associated with the visual attributes. I think you were on the right track with alpha, you just need to add columns to associate with the alpha for each glyph, then toggle it between 0 and 1 and push the updated data to the notebook.
The other option is just to make it as a standalone app as a static html page using JS callbacks, or to use the server. I imagine that the shiny example would face similar issues.
On Tuesday, September 15, 2015 at 11:54:19 AM UTC-5, Lien Michiels wrote:
Thanks for your answer. This is what my application currently looks like:
I'm using the on_trait_change attribute of the widgets to update them exactly the way I want to. The capabilities of interact were unfortunately too limited in this case :-). In general they work really well though.
Problem is that when I try to interact with the Bokeh plot I am not sure what to do. Redraw it entirely? But would that have an effect on the cell it is displayed in? How do I delete the plot to replace it with a new one?
I was hoping to be able to simply interact with it, but I haven't yet figured it out.
After spending a whole day, I thought I might be better of asking you guys ;-).
Op dinsdag 15 september 2015 18:43:30 UTC+2 schreef Tom:
One option is ipython widgets. Good examples live here:
I find the @interact decorator particularly useful. It is demoed in the Interact.ipynb.
There may be some bokeh specific ways to do better but they should give you a nice start.
On Tuesday, September 15, 2015 at 11:02:15 AM UTC-4, Lien Michiels wrote:
The behaviour that I'm sort of trying to recreate using the Jupyter Notebooks and Bokeh is this: http://shiny.rstudio.com/gallery/faithful.html
So far I've managed to update the number of bins and the bandwidth and thus change the plot (ColumnDataSource, hooray!) but I cannot seem to hide/show the density estimate or individual observations.
Essentially I think it's possible and I'm not even far off...
So far I tried to hack my way around the issue by
- updating the value of the alpha to 0.0 -> Alpha is not in my ColumnDataSource so whatever I try it obviously won't update the plot because I'm not pushing anything to the notebook
- Set all values to None in updating the plot -> Obviously not a good idea
Is there a way to do this? And if not, would it be interesting for you guys to implement this kind of behaviour and is there any way in which I can help?
Loving Bokeh by the way. Kudos to all of you!
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/603355a1-61b5-4bf7-931c-2175aa9b05fd%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.