Repository navigation
Fix network crash error - #3856
Conversation
8edaafd to
e8d286c
Compare
c72ea8e to
4cea9bf
Compare
|
Nice work consolidating the array handling into |
|
Good catch, and I checked — it's real (np.asarray(["blue", (1.0,0.0,0.0,1.0)]) raises the same ValueError). It's a separate pre-existing bug though, not something this PR introduces — happens on current main too.Happy to pick it up right after this merges since the fix is basically the same pattern. |
|
How does this relate to #3712 |
#3856 fixes the same root cause as #3712 (#2691) — collect_agent_data only appended edgecolors when an agent's portrayal set it, so that array could end up shorter than every other per-agent array (loc, marker, zorder), causing the boolean-index IndexError. |
|
there is a conflict that must be resolved before this can be merged. Code wise it looks fine to me. |
|
Is it regarding the object array fallback asked by dilraj or any other conflicts? |
|
it seems import related so trivial to fix. I can probably handle it if needed but would be good if you can take a quick lok. |
|
Found it and fixed it too — test_components_matplotlib.py had two PRs adding different names to the same mpl_space_drawing import list (_get_hexmesh from another PR, _to_numpy_argument_array from mine). |
* Fix network crash error in matplotlib backend network drawing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix remaining IndentationError and edgecolors length bug in matplotlib backend * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit 8503a32)
Fixes #2691 and #3712 follow up
Bug
collect_agent_datain bothmpl_space_drawing.pyandMatplotlibBackendonly addededgecolorswhen an agent provided it.If only some agents had
edgecolors, the array length became smaller than other agent data arrays (loc,marker,zorder, etc.), causing anIndexErrorduring boolean indexing.Fix
edgecolorsentry per agent.Nonewhen an agent does not specify a value, keeping all arrays aligned.Also added a shared
_to_numpy_argument_array()helper inmpl_space_drawing.pyand reused it inMatplotlibBackendto avoid duplicate array handling logic.The helper correctly handles:
Nonevalues(numsides, style, angle)