Skip to content

Commit

Permalink
fix: fix edge label plotting in Plotly
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Jul 10, 2023
1 parent 47ec024 commit 35a4ba4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/igraph/drawing/plotly/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@ def draw(self, graph, *args, **kwds):
"text": [],
"x": [],
"y": [],
"color": [],
# "textfont_color": [],
# FIXME: horizontal/vertical alignment, offset, etc?
}
for label, visual_edge, edge in edge_label_iter:
# Ask the edge drawer to propose an anchor point for the label
src, dest = edge.tuple
src_vertex, dest_vertex = vertex_builder[src], vertex_builder[dest]
(x, y), (halign, valign) = edge_drawer.get_label_position(
edge,
visual_edge,
src_vertex,
dest_vertex,
)
Expand All @@ -268,7 +268,9 @@ def draw(self, graph, *args, **kwds):
lab_args["text"].append(label)
lab_args["x"].append(x)
lab_args["y"].append(y)
lab_args["color"].append(visual_edge.label_color)
# FIXME: colors do not work yet; apparently we need to convert
# visual_edge.label_color to Plotly's format
# lab_args["textfont_color"].append(visual_edge.label_color)
stroke = plotly.graph_objects.Scatter(
mode="text",
**lab_args,
Expand Down

0 comments on commit 35a4ba4

Please sign in to comment.