Related to it working if you go run the code in JupyterLab and then back to the classic interface, I wonder if what (Tony Hirst) notes in his blog post has anything to do with it: # The Layout adds some styling to our app.Īpp_layout = widgets.Layout(display='flex',Īpp=widgets.Box(, layout=app_layout)Īnd with that being so weird to get working, I wonder if you original code works if you go through all that. """Create the full app with menu and output""" #heatmap_out = widgets.interactive_output(heatmap,) #heatmap_out = widgets.interactive_output(heatmap, size = size, title=title) #heatmap_out = interactive(heatmap, size = size, title=title) We need it to properly mutate the current Ticker=BasicTicker(desired_num_ticks=len(colors)))įig = # Storing the figure in a singular list is a bit of a Mapper = LinearColorMapper(palette=colors, low=viz_(),Ĭolor_bar = ColorBar(color_mapper=mapper, location=(0, 0), Title_widget = widgets.interact(change_title,x=title) Size_widget = widgets.interact(change_size,x=size) Min_max_pts = įor pt in ransform(min_max_pts): #grouped_poptable2 = grouped_poptable2!=0] Viz_table, viz_table = ansform(viz_table.values, Viz_table =viz_table.drop_duplicates(subset=, ignore_index=True) Viz_table = viz_oupby().sum().reset_index() #Have to convert to 2 decimal places otherwise to dense # The output widget is where we direct our figuresĭata_store =pd.HDFStore(".\data\density.h5") Line_color=None, fill_color= transform("Population", mapper), alpha=0.07) #convert source to selected dictionary value X_axis_type="mercator", y_axis_type="mercator") P2 = figure(plot_width=size, plot_height=size, title=title, """This is a helper function that creates a new figure and It creates a new figure according to the new dropdown values.""" """This function is executed when a dropdown value is changed. """Define callback function for the UI""" I don’t know why: hide_code()įrom IPython.display import display, clear_output Widgets work, but for some reason they show their values as text near them during the preparing stage. Usually shows the plot twice when cell first runs, but when you change the size or text it only loads one plot at that point. Then it will sort of work by finally showing a plot. To get it to work first I have to try running it in JupyterLab and see the error that will be like Javascript Error: Error rendering Bokeh model: could not find #9ee3112f-b0fa-478a-86f5-f925a328c52b HTML tag, then stop the kernel, and run it in the classic interface, ignoring the error May also see NameError: name ‘mapper’ is not defined` that pops up the first time or two. HUGE, STRANGE CAVEAT: It is super glitchy though. I place this code in place of your plotting cell. (You may wish to see here & note ipywidgets now need an output widget capturing the output to display.)īelow results in close to what you had and works at some level. So seeing that one here work that seems to use modern ipywidgets practices as evidenced by the use of output_figure = widgets.Output(), I wonder if it could be adapted. Although, oddly that change was enough to get your size-adjusting and title widgets to display, but the plot wouldn’t. However, Bokeh is much different & just switching to interactive as a work-around wasn’t enough, like it was in those other cases. I suspect your issue is related to the issue I think am seeing with ipywidget’s interact() and current MyBinder launches. I note it uses interactive() (see below) and so trying to see if it is adaptable to fix your stuff. There is an interactive Bokeh that presently works in the classic notebook interface in launches from your instance after running %pip install sklearn first: here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |