Open johann-petrak opened 4 years ago
This will require some thought your intuition about the cause here is correct in that 'x' and 'y' are the default dimensions describing the positions of the nodes and are therefore reserved by default. We will have to consider where to add a better error and/or whether to use default dimension names which are not going to clash.
As the example shows, the values of the x and y attributes actually are the positions that would get pased on as pos to the draw function. So in this case, the draw function could just use the x and y attributes and it seems natural to do this, so it would be good to allow something like pos=("x","y") to retrieve the positions directly from the nodes instead of from a separate data structure.
If the draw function needs to use some names for x and y for the internal data structure which should not clash with names derived from the nodes, then some scheme for reserved names would be good, e.g. "x" and "y" or "__name" in general. It could then be documented that attributes starting with a double underscore cannot be used.
I try to use hvplot.networkx from hvplot version 0.5.2 with bokeh to visualize a network graph.
This is code that works: a simple graph is created using networkx, and some attributes are added to the graph nodes, then hvplot is used to show the graph and show hover tooltips from the attributes:
The following code throws the exception: here the node has an attribute "x" (or "y", but "z" is ok):
Exception:
Why is "x" or "y" not usable as an attribute, are there other names that would not work and if there are reserved names, could the error message be more informative?