plotly_ipywidget_notebooks
plotly_ipywidget_notebooks copied to clipboard
Interact.ipynb raises exception
When I execute the cells of the Interact.ipynb
I get an exception after executing the last cell:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
c:\users\florian\.virtualenvs\data-processing-a_m7qh6p\lib\site-packages\ipywidgets\widgets\interaction.py in update(self, *args)
254 value = widget.get_interact_value()
255 self.kwargs[widget._kwarg] = value
--> 256 self.result = self.f(**self.kwargs)
257 show_inline_matplotlib_plots()
258 if self.auto_display and self.result is not None:
<ipython-input-16-8163515321f0> in update(a, b, color)
4 def update(a=3.6, b=4.3, color='blue'):
5 with fig.batch_update():
----> 6 scatt.x=xs
7 scatt.y=np.sin(a*xs-b)
8 scatt.line.color=color
c:\users\florian\.virtualenvs\data-processing-a_m7qh6p\lib\site-packages\plotly\basedatatypes.py in __setattr__(self, prop, value)
349 else:
350 # Raise error on unknown public properties
--> 351 raise AttributeError(prop)
352
353 def __getitem__(self, prop):
AttributeError: x
Package versions:
ipywidgets==7.5.1
numpy==1.17.3
plotly==4.2.1
Same here. Does someone have a solution for this?
I solved this. Just add .data[0] to add_scatter()
I was coming here to report the same fix! this fix works. please merge this!
Thank you @StepanSmirnov. It works. BTW what does it mean: ".data[0]"?