python - ipywidgets: how to update plot with multiple series based on checkbox selection -
i using ipython notebook, pandas library, , bokeh plotting library , have function generates gridplot. trying set checkboxes, each checkbox corresponding 1 of plots , update gridplot plots have corresponding checkboxes selected. there not seem support ipywidgets libray. attempt far; not sure how pass checkboxes created function update gridplot though, appreciated. thanks.
attributes = df.columns.tolist() ipywidgets import checkbox, interact ipython.display import display chk = [checkbox(description=attributes[i]) in range(len(attributes))] #this displays checkboxes created correctly display(*chk) #update plot takes in names of columns displayed , returns #a gridplot containing corresponding plots #not sure part below though interact(updateplot,args=chk)
this displays checkboxes , calls updateplot function they're changed:
from ipywidgets import checkbox, interactive ipython.display import display l = ["dog", "cat", "mouse"] chk = [checkbox(description=a) in l] def updateplot(**kwargs): print [(k,v) k, v in kwargs.iteritems()] interact(updateplot, **{c.description: c.value c in chk})
Comments
Post a Comment