Open BankNatchapol opened 1 month ago
Hi, thanks for raising the issue.
k
? This parameter determines the straightness of the edges. g = Graph(triangle, edge_layout='curved', edge_layout_kwargs=dict(k=0.025))
You can install the dev branch via pip:
pip install https://github.com/paulbrodersen/netgraph/archive/dev.zip
@paulbrodersen Thank you for your answer.
i haved tried install with pip install https://github.com/paulbrodersen/netgraph/archive/dev.zip (nothing change)
and also tried removing edge_layout_kwargs=dict(k=0.025)
This is the result
which is still not completely correct, there should be 2 edges a->c and c->a
code:
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from netgraph import Graph
fig, (ax1, ax2) = plt.subplots(1, 2)
triangle = [(0, 1), (0, 2), (1, 1), (1, 2), (2, 0)]
node_positions = {
0 : np.array([0.2, 0.2]),
1 : np.array([0.5, 0.8]),
2 : np.array([0.8, 0.2]),
}
g = Graph(
triangle,
node_layout=node_positions, edge_layout='curved',
node_labels={0 : 'a', 1 : 'b', 2 : 'c'},
edge_labels=True, edge_label_fontdict=dict(fontweight='bold'),
ax=ax1,
)
h = Graph(nx.complete_graph(7), edge_width=0.5, node_labels=True,
node_label_fontdict=dict(size=14), node_label_offset=0.075, ax=ax2)
The edge layout key-word argument bundle_parallel_edges
used to be False
by default but is now True
(no idea how that happened). You can restore the original behaviour by setting it to False
explicitly:
g = Graph(
triangle,
node_layout=node_positions, edge_layout='curved', edge_layout_kwargs=dict(bundle_parallel_edges=False),
node_labels={0 : 'a', 1 : 'b', 2 : 'c'},
edge_labels=True, edge_label_fontdict=dict(fontweight='bold'),
ax=ax1,
)
From this example: https://netgraph.readthedocs.io/en/latest/sphinx_gallery_output/plot_06_labels.html#sphx-glr-sphinx-gallery-output-plot-06-labels-py the graph should looks like this
but, it's this instead
![image](https://github.com/paulbrodersen/netgraph/assets/53829777/09c58a5f-f2b2-4731-b028-4609b9fbcafe)