Skip to content

Interact.ipynb raises exception #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fkromer opened this issue Nov 21, 2019 · 4 comments
Open

Interact.ipynb raises exception #9

fkromer opened this issue Nov 21, 2019 · 4 comments

Comments

@fkromer
Copy link

fkromer commented Nov 21, 2019

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
@HannesThielke
Copy link

HannesThielke commented Mar 13, 2020

Same here. Does someone have a solution for this?

@StepanSmirnov
Copy link

I solved this. Just add .data[0] to add_scatter()

StepanSmirnov added a commit to StepanSmirnov/plotly_ipywidget_notebooks that referenced this issue May 1, 2020
@ljburtz
Copy link

ljburtz commented Nov 4, 2020

I was coming here to report the same fix! this fix works. please merge this!

@almirmav
Copy link

almirmav commented Dec 3, 2020

Thank you @StepanSmirnov. It works.
BTW what does it mean: ".data[0]"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants