Skip to content

Error on plotting DiffusionTrend #2

@llaltxll

Description

@llaltxll

When running cell 9 of Network Science Book, Chapter 3.ipynb, creating the DiffusionTrend visualization fails with the following trace back:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[9], line 6
      3 from ndlib.viz.bokeh.DiffusionTrend import DiffusionTrend
      5 viz = DiffusionTrend(model, trends)
----> 6 p = viz.plot(width=500, height=400)
      7 show(p)

File ~\anaconda3\Lib\site-packages\ndlib\viz\bokeh\DiffusionViz.py:59, in DiffusionPlot.plot(self, percentile, width, height)
     57 mx = len(l[0])
     58 if self.normalized:
---> 59     p.line(list(range(0, mx)), l[1] / self.nnodes, line_width=2, legend=self.srev[k], alpha=0.5, color=cols[i])
     60 else:
     61     p.line(list(range(0, mx)), l[1], line_width=2, legend=self.srev[k], alpha=0.5, color=cols[i])

File ~\anaconda3\Lib\site-packages\bokeh\plotting\_decorators.py:89, in glyph_method.<locals>.decorator.<locals>.wrapped(self, *args, **kwargs)
     87 if self.coordinates is not None:
     88     kwargs.setdefault("coordinates", self.coordinates)
---> 89 return create_renderer(glyphclass, self.plot, **kwargs)

File ~\anaconda3\Lib\site-packages\bokeh\plotting\_renderer.py:133, in create_renderer(glyphclass, plot, **kwargs)
    127 plot.renderers.append(glyph_renderer)
    129 if legend_kwarg:
    130     # It must be after the renderer is added because
    131     # if it creates a new `LegendItem`, the referenced
    132     # renderer must already be present.
--> 133     update_legend(plot, legend_kwarg, glyph_renderer)
    135 return glyph_renderer

File ~\anaconda3\Lib\site-packages\bokeh\plotting\_legends.py:57, in update_legend(plot, legend_kwarg, glyph_renderer)
     54 legend = _get_or_create_legend(plot)
     55 kwarg, value = next(iter(legend_kwarg.items()))
---> 57 _LEGEND_KWARG_HANDLERS[kwarg](value, legend, glyph_renderer)

KeyError: 'legend'

Tested on Windows and Linux, same result.

Any clues?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions