ricklupton / ipysankeywidget

IPython / Jupyter Sankey diagram widget
MIT License
174 stars 24 forks source link

Example 4: Colour-intensity scales appears to be broken #73

Closed JoeyBream closed 1 year ago

JoeyBream commented 2 years ago

Hi, there appears to be an issue with the fourth example. It returns the following error when it attempts to weave a diagram.

KeyError                                  Traceback (most recent call last)
<ipython-input-10-df348d8752fe> in <module>
      4 
      5 sdd = SankeyDefinition(nodes, bundles, ordering)
----> 6 weave(sdd, dataset, measures='Calories Burnt').to_widget(**size_options)

/srv/conda/envs/notebook/lib/python3.7/site-packages/floweaver/sankey_data.py in to_widget(self, width, height, margins, align_link_types, link_label_format, link_label_min_width, debugging)
     80             }
     81 
---> 82         value = self.to_json(format="widget")
     83         widget = SankeyWidget(
     84             nodes=value["nodes"],

/srv/conda/envs/notebook/lib/python3.7/site-packages/floweaver/sankey_data.py in to_json(self, filename, format)
     35             data = {
     36                 "nodes": [n.to_json(format) for n in self.nodes],
---> 37                 "links": [l.to_json(format) for l in self.links],
     38                 "order": self.ordering.layers,
     39                 "groups": self.groups,

/srv/conda/envs/notebook/lib/python3.7/site-packages/floweaver/sankey_data.py in <listcomp>(.0)
     35             data = {
     36                 "nodes": [n.to_json(format) for n in self.nodes],
---> 37                 "links": [l.to_json(format) for l in self.links],
     38                 "order": self.ordering.layers,
     39                 "groups": self.groups,

/srv/conda/envs/notebook/lib/python3.7/site-packages/floweaver/sankey_data.py in to_json(self, format)
    180                 "type": self.type,
    181                 "time": self.time,
--> 182                 "value": self.data["value"],
    183                 "title": self.title,
    184                 "color": self.color,

KeyError: 'value'

Do you have any ideas what the problem might be? I really enjoy this package and would appreciate the opportunity to know it better.

ricklupton commented 1 year ago

Thanks for reporting. Should be fixed by https://github.com/ricklupton/floweaver/pull/130

JoeyBream commented 1 year ago

Awesome, thank you