Figure Widget plot error in Datashader Case Study

I’ve been developing some plots based on the datashader case study. They are rendering and functioning well but I always get an error the first time the plot is shown. The plot is still rendered and interactive.

I thought it had to do with my implementation but it remains the same when I tried running the example.

f = go.FigureWidget(data=[{'x': x_range, 
                           'y': y_range, 
                           'mode': 'markers',
                           'marker': {'opacity': 0}}], # invisible trace to init axes and to support autoresize
                    layout={'width': plot_width, 'height': plot_height})

After I run the previous cell in that example this error is raised:

AttributeError                            Traceback (most recent call last)
/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/ipywidgets/widgets/ in _handle_msg(self, msg)
    667                 if 'buffer_paths' in data:
    668                     _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 669                 self.set_state(state)
    671         # Handle a state request.

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/ipywidgets/widgets/ in set_state(self, sync_data)
    537                     from_json = self.trait_metadata(name, 'from_json',
    538                                                     self._trait_from_json)
--> 539                     self.set_trait(name, from_json(sync_data[name], self))
    541     def send(self, content, buffers=None):

/usr/local/anaconda3/envs/arara/lib/python3.6/ in __exit__(self, type, value, traceback)
     86         if type is None:
     87             try:
---> 88                 next(self.gen)
     89             except StopIteration:
     90                 return False

~/.local/lib/python3.6/site-packages/traitlets/ in hold_trait_notifications(self)
   1129                 for changes in cache.values():
   1130                     for change in changes:
-> 1131                         self.notify_change(change)
   1133     def _notify_trait(self, name, old_value, new_value):

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/ipywidgets/widgets/ in notify_change(self, change)
    598                 # Send new state to front-end
    599                 self.send_state(key=name)
--> 600         super(Widget, self).notify_change(change)
    602     def __repr__(self):

~/.local/lib/python3.6/site-packages/traitlets/ in notify_change(self, change)
   1174                 c = getattr(self,
-> 1176             c(change)
   1178     def _add_notifiers(self, handler, name, type):

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/plotly/ in _handler_js2py_layoutDelta(self, change)
    562             # ### Dispatch change callbacks ###
--> 563             self._dispatch_layout_change_callbacks(delta_transform)
    565             # ### Layout edits no longer in process ###

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/plotly/ in _dispatch_layout_change_callbacks(self, relayout_data)
   1573         # ---------------------------------------
   1574         for path_tuple, changed_paths in dispatch_plan.items():
-> 1575             if path_tuple in self.layout:
   1576                 dispatch_obj = self.layout[path_tuple]
   1577                 if isinstance(dispatch_obj, BasePlotlyType):

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/plotly/ in __contains__(self, prop)
   3642         """
   3643         prop = self._strip_subplot_suffix_of_1(prop)
-> 3644         return super(BaseLayoutHierarchyType, self).__contains__(prop)
   3646     def __setitem__(self, prop, value):

/usr/local/anaconda3/envs/arara/lib/python3.6/site-packages/plotly/ in __contains__(self, prop)
   2685                     return False
   2686             else:
-> 2687                 if p in obj._validators:
   2688                     obj = obj[p]
   2689                 else:

AttributeError: 'dict' object has no attribute '_validators'

Inspecting the obj in the traceback indicates that these are the plot options:

ipdb> prop 
('title', 'font')
ipdb> obj 
{'text': 'Click to enter Plot title', 'font': {'family': '"Open Sans", verdana, arial, sans-serif', 'size': 17, 'color': '#444'}, 'xref': 'container', 'yref': 'container', 'x': 0.5, 'y': 'auto', 'xanchor': 'auto', 'yanchor': 'auto', 'pad': {'t': 0, 'r': 0, 'b': 0, 'l': 0}}

My plotly is at version 3.2.1
I don’t know how to check my plotly widget extensions jupyter nbextension list shows I have it enable but doesn’t show the version

Hi @neuronist,

I just tried the example with version 3.6.1 and I’m not seeing an error. Could you try updating? Thanks!


It fixed it. Thanks.

1 Like