Skip to content

Commit a82513c

Browse files
committed
ENH(plot); from-data edges as dot
1 parent 5e0993f commit a82513c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

graphtik/plot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ class Theme:
612612
##
613613

614614
kw_edge = {"tailport": "s", "headport": "n"}
615+
kw_edge_tail_op = {}
616+
kw_edge_head_op = {"arrowtail": "dot", "dir": "both"}
615617
kw_edge_optional = {"style": ["dashed"]}
616618
kw_edge_sideffect = {"color": "blue"}
617619
#: Added conditionally if `alias_of` found in edge-attrs.
@@ -1263,6 +1265,10 @@ def _make_edge(self, plot_args: PlotArgs) -> pydot.Edge:
12631265
styles = self._new_styles_stack(plot_args)
12641266

12651267
styles.add("kw_edge")
1268+
if isinstance(src, Operation):
1269+
styles.add("kw_edge_tail_op")
1270+
if isinstance(dst, Operation):
1271+
styles.add("kw_edge_head_op")
12661272
if edge_attrs.get("optional"):
12671273
styles.add("kw_edge_optional")
12681274
if edge_attrs.get("sideffect"):

test/test_plot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,10 @@ def test_node_dot_str0(dot_str_pipeline):
562562
><B>FN:</B> test.test_plot.func</TD>
563563
</TR>
564564
</TABLE>>, shape=plain, tooltip=<cu:sto:m>];
565-
<edge> -> <node> [headport=n, tailport=s];
566-
<edge> -> <cu&#58;sto&#58;m> [headport=n, tailport=s];
567-
<digraph&#58; strict> -> <node> [headport=n, tailport=s];
568-
<digraph&#58; strict> -> <cu&#58;sto&#58;m> [headport=n, tailport=s];
565+
<edge> -> <node> [arrowtail=dot, dir=both, headport=n, tailport=s];
566+
<edge> -> <cu&#58;sto&#58;m> [arrowtail=dot, dir=both, headport=n, tailport=s];
567+
<digraph&#58; strict> -> <node> [arrowtail=dot, dir=both, headport=n, tailport=s];
568+
<digraph&#58; strict> -> <cu&#58;sto&#58;m> [arrowtail=dot, dir=both, headport=n, tailport=s];
569569
<node> -> <&lt;graph&gt;> [headport=n, tailport=s];
570570
<cu&#58;sto&#58;m> -> <&lt;graph&gt;> [headport=n, tailport=s];
571571
legend [URL="https://graphtik.readthedocs.io/en/latest/_images/GraphtikLegend.svg", fillcolor=yellow, shape=component, style=filled, target=_blank];
@@ -607,8 +607,8 @@ def test_node_dot_str1(dot_str_pipeline, monkeypatch):
607607
</TABLE>>, shape=plain, tooltip=<cu:sto:m>];
608608
}
609609
610-
<edge> -> <cu&#58;sto&#58;m> [headport=n, tailport=s];
611-
<digraph&#58; strict> -> <cu&#58;sto&#58;m> [headport=n, tailport=s];
610+
<edge> -> <cu&#58;sto&#58;m> [arrowtail=dot, dir=both, headport=n, tailport=s];
611+
<digraph&#58; strict> -> <cu&#58;sto&#58;m> [arrowtail=dot, dir=both, headport=n, tailport=s];
612612
<cu&#58;sto&#58;m> -> <&lt;graph&gt;> [headport=n, tailport=s];
613613
legend [URL="https://graphtik.readthedocs.io/en/latest/_images/GraphtikLegend.svg", fillcolor=yellow, shape=component, style=filled, target=_blank];
614614
}

0 commit comments

Comments
 (0)