summaryrefslogtreecommitdiff
path: root/networkx/drawing
Commit message (Collapse)AuthorAgeFilesLines
* Added docstring examples for nx_pylab.py (#6616)cnfionawu2023-05-021-0/+36
| | | Update nx_pylab.py
* Preserve node order in bipartite_layout (#6644)Haoyang Li2023-04-171-3/+3
| | | | | * Keep the original order of the nodes in bipartite_layout * Keep the original order of the nodes in bipartite_layout
* Fix handling of pos node attribute in to_agraph (#6474)Navya Agarwal2023-04-062-0/+19
| | | | Make sure the `"pos"` node attribute is properly formatted for pygraphviz, if present.
* Fix typos (#6620)Harri Nieminen2023-04-043-7/+7
|
* Update pre-commit (#6545)Jarrod Millman2023-03-232-3/+3
|
* Lint using Ruff (#6371)danieleades2023-02-191-1/+1
| | | | | | | | | | | | | | | * lint and fix using ruff * add flake8-pie lints * remove useless import alias * bump version * bump deps --------- Co-authored-by: daniel.eades <daniel.eades@hotmail.com>
* Update developer requirements (#6429)Jarrod Millman2023-02-141-1/+0
| | | | | * Update developer requirements * Run linter
* provide tikz with degrees, not radians (#6360)Dima Pasechnik2023-01-171-2/+2
| | | | | * provide tikz with degrees, not radians * set default radius to 2
* DOC: Minor formatting fixups to get rid of doc build warnings. (#6363)Ross Barnowski2023-01-131-66/+66
| | | Minor formatting fixups to get rid of doc build warnings.
* Fix typos in the networkx codebase (#6335)Anurag Bhat2023-01-053-6/+6
| | | | | * Fix_Typos * Commit_Suggestions
* Create a Tikz latex drawing feature for networkx (#6238)Dan Schult2023-01-043-0/+864
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implemented conversion from networkx graph to latex graph. * Removed latex cache files uploaded by error. * Resolved placeholders file import issue. * Removed dependency to numpy * Updated test * Wrapped test for numpy dependency * Updated test name * format changes to nx_latex.py and friends. vertex -> node, vertices -> nodes PEP8 spacing and tabs pytest function instead of class (class not needed here -- no imports) Moved author info to CONTRIBUTORS.rst as our new standard converted list comprehension done for side-effects to for-loop. switch to f-strings from string-format calls update setup.py to remove conflicts * Remove numpy requirement for testing latex Also pep8 formatting * reorder imports in __init__ * Attempt to debug windows/appveyor adigraph error * try again * Remove types, run pre-commit * blackify * pyupgradify * inline latex placeholders and expected_tex. Check not multigraph. Add example Change variable name `file` to `latex_code` inline if/else for __init__ setup * Change tabs to spaces * pull apart Adigraph to simplify interface * remove class Adigraph completely in favor of functions * replace default layout to be circular. (matches adigraph and avoids using random seeds in tests * fix old version of isort result * update documentation and include with rst file. Update some tests * make docs more complete, checked and add tests * Cleanup extra file changes that aren't needed * Add TikZ version of to_latex as default * improve docs * Make the networkx latex interface via TikZ and not adigraph * fix rebase * Apply suggestions from code review Co-authored-by: Mridul Seth <mail@mriduls.com> * comment out print statements in tests * Turn off multigraph for latex * Remove tests of `line width` and edge label placement * add back line width style, fix placement of style on edges. * Set default layout to have radius 10 Co-authored-by: Mridul Seth <mail@mriduls.com> * fix docstring test * Minor docstring formatting nits. Co-authored-by: Luca Cappelletti <cappelletti.luca94@gmail.com> Co-authored-by: Mridul Seth <seth.mridul@gmail.com> Co-authored-by: Mridul Seth <git@mriduls.com> Co-authored-by: Mridul Seth <mail@mriduls.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* doc: clarify allowed `alpha` when using nx.draw_networkx_edges (#6254)Sultan Orazbayev2022-12-051-2/+5
| | | | | * doc: clarify allowed `alpha` when using nx.draw_networkx_edges Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Warn on unused visualization kwargs that only apply to FancyArrowPatch edges ↵Ross Barnowski2022-10-212-4/+73
| | | | | | | | | | | (#6098) * Add test for UserWarning with ignored vizopts. * Implement UserWarning for bad vizopts combos. * Fix instance in test suite caught by new warnings. * Update test to check warnings are *not* raised when using FAPs.
* Fix warnings from running tests in randomized order (#6014)Ross Barnowski2022-10-061-3/+4
| | | | | | | | | | | * Use toarray instead of .A for sparse array conversion. Missed this example in the test suite during the sparse cleanup. * Fix crosstalk of axis object between tests. This now raises a dep warning for mpl 3.6 and will result in explicit exceptions in the future.
* Arf layout (#5910)Casper van Elteren2022-08-232-1/+139
| | | | | | | | | | | | | | | | | | | | | * added arf_layout * reference to docstring and comparison to spring layout * rebase to origin main * black re-format * Left aligned docstring text * Cleaned up computation and update variables to new docstring * Updated naming tests. Added input check on arf_layout parameter `a` * Fixed Linter issues for py38 target * Fixed Linter issues for target p38 * linter issue fixed
* See matplotlb 3.6rc1 failure (#5937)Jarrod Millman2022-08-211-3/+3
| | | | | | | | | | | * See matplotlb 3.6rc1 failure * replace use of private class method to allow mpl v3.6 to work. * ensure ax exists before calling colorbar * Undo matplotlib pin Co-authored-by: Dan Schult <dschult@colgate.edu>
* Add warning to nx_agraph about layout nondeterminism. (#5832)Ross Barnowski2022-07-011-1/+15
|
* Fix pydot colon check node-to-str conversion (#5809)Shaked Brody2022-06-232-3/+16
|
* Add more comprehensive tests for pydot (#5792)Mridul Seth2022-06-222-5/+29
| | | | | | | * Add more comprehensive tests for pydot * remove the second element from frozenset for cleaner tests Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Change PyDot PendingDeprecation to Deprecation (#5781)Dan Schult2022-06-161-6/+6
|
* Remove deprecated display_pygraphviz (#5754)Juanita Gomez2022-06-151-49/+0
| | | | | * Remove deprecated display_pygraphviz * Remove display pygraphviz from deprecations file
* Add PendingDeprecation for pydot (#5721)Jarrod Millman2022-06-111-0/+44
| | | | | * Add PendingDeprecation for pydot * Link to tracking issue
* Recover order of layers in multipartite_layout when layers are sortable (#5705)Ross Barnowski2022-06-092-2/+28
| | | | | | | | | | | * Add test for sorted layers. * Implement layer sorting when possible. Co-authored-by: Dan Schult <dschult@colgate.edu> * Add test case for non-sortable layers. Co-authored-by: Dan Schult <dschult@colgate.edu>
* Catch ':' explicitly while working with pydot (#5710)Mridul Seth2022-06-092-21/+118
| | | | pydot has it's own mechanism to deal with quoting strings we shouldn't try to change that.
* Use isort with pre-commit to enforce import guidelines (#5659)Mridul Seth2022-06-026-17/+23
| | | | | * Add isort to pre-commit * Run isort on all python files (except __init__.py ones)
* Remove redundant py2 numeric conversions (#5661)Mridul Seth2022-05-311-2/+2
| | | | | | | | | * Remove redundant float conversion * Remove redundant int conversion * Use integer division Co-authored-by: Miroslav Šedivý <6774676+eumiro@users.noreply.github.com>
* Error out when pydot fails to correctly parse node names (#5667)Mridul Seth2022-05-262-4/+25
|
* Extract valid kwds from the function signature for draw_networkx_* (#5660)Mridul Seth2022-05-251-50/+17
| | | | | This makes sure we don't miss the cases where we add a new argument to a draw_networkx_* and not update the valid kwargs in draw_networkx.
* Replace np.flip with indexing in layouts. (#5623)Ross Barnowski2022-05-111-2/+2
|
* improve docstring for read_doc, see issue #5604 (#5605)Horst JENS2022-05-051-1/+1
|
* Change default value of arrowstyle for undirected graphs (#5514)Dilara Tekinoglu2022-04-121-3/+13
| | | | | | | | | * Change default value of arrowstyle for undirected graphs * Update networkx/drawing/nx_pylab.py Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com> Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
* Rm incorrect reference from spiral_layout docstring. (#5503)Ross Barnowski2022-04-081-6/+0
|
* Fix for issue 5212 (#5471)Lukong1232022-04-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | * added references * added gallery example * fixed error * fixed error * Update networkx/drawing/layout.py Co-authored-by: Mridul Seth <mail@mriduls.com> * Update networkx/drawing/layout.py Co-authored-by: Mridul Seth <mail@mriduls.com> * added example on edge cover * Revert "added example on edge cover" This reverts commit 27a7277622a45e361a60ddfc1b04b6b18acd6900. * add a link break Co-authored-by: Mridul Seth <mail@mriduls.com>
* added extra condition for fancy arrow colors (#5407)blokhinnv2022-04-042-5/+37
| | | | | | | | | * added extra condition for fancy arrow colors * keep fancy edges ids to get a correct prop's value * Add test for selfloop color mapping in undirected graphs. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update black (#5438)Mridul Seth2022-03-291-6/+6
| | | | | | | * CI: sync up black dev requirements version with precommit * Run black Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
* [nx_pylab] fix StopIteration, if empty dict is passed for labels. (#5372)Martin K. Scherer2022-03-042-2/+13
| | | | | | | | | | | | | | | | | * [nx_pylab] fix StopIteration, if empty dict is passed for labels. The new detection for multi-edge labels raises, if an empty dict was passed. Before this detection that was fine, because the loop iterating over the passed labels just passed. Added small test as well. * incorporate suggestions [ci skip] * Add regression test for empty edge label dict. * Simplify dict lookup (keys only). Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Fix spiral_layout when equidistant=True (#5354)Anutosh Bhat2022-02-272-4/+17
| | | | | Fixes positioning of first node when equidistant=True. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Use pytest-mpl (#4579)Jarrod Millman2022-02-122-0/+26
| | | | | | | | | | | | | | | | | | | | | | | * Use pytest-mpl * Try circleci * New * Fix * Fix test * Add documentation * Install default requirments on Circle CI * Install pytest on circle CI * Update python image * Test house w/ colors Co-authored-by: Mridul Seth <mail@mriduls.com>
* Add informative exception for drawing multiedge labels. (#5316)Ross Barnowski2022-02-122-0/+22
|
* Update `draw_<layout>` docstrings with usage examples (#5264)Ross Barnowski2022-02-121-37/+172
| | | | | | | | | | | | | | | | | | | | | | * Update descriptions, add Notes and SeeAlso sections. Notify users that the draw_ fns are shorthand for using the layouts explicitly. * Fix gh-5215. * Rm unused warnings. * Rm >>> to prevent doctest from running. * Fix planar layout example with planar graph. * Fix links to layout functions (cross-module. * Fix misnamed layout in example Co-authored-by: Mridul Seth <mail@mriduls.com> Co-authored-by: Mridul Seth <mail@mriduls.com>
* Use scipy.sparse array datastructure (#5139)Ross Barnowski2022-01-182-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Step 1: use sparse arrays in nx.to_scipy_sparse_matrix. Seems like a reasonable place to start. nx.to_scipy_sparse_matrix is one of the primary interfaces to scipy.sparse from within NetworkX. * 1: Use np.outer instead of mult col/row vectors Fix two instances in modularitymatrix where a new 2D array was being created via an outer product of two \"vectors\". In the matrix case, this was a row vector \* a column vector. In the array case this can be disambiguated by being explicit with np.outer. * Update _transition_matrix in laplacianmatrix module - A few instances of matrix multiplication operator - Add np.newaxis + transpose to get shape right for broadcasting - Explicitly convert e.g. sp.sparse.spdiags to a csr_array. * Update directed_combinitorial_laplacian w/ sparse array. - Wrap spdiags in csr_array and update matmul operators. * Rm matrix-specific code from lgc and hmn modules - Replace .A call with appropriate array semantics - wrap sparse.diags in csr_array. * Change hits to use sparse array semantics. - Replace * with @ - Remove superfluous calls to flatten. * Update sparse matrix usage in layout module. - Simplify lil.getrowview call - Wrap spdiags in csr_array. * lil_matrix -> lil_array in graphmatrix.py. * WIP: Start working on algebraic connectivity module. * Incorporate auth mat varname feedback. * Revert 1D slice and comment for 1D sparse future. * Add TODOs: rm csr_array wrapper around spdiags etc. * WIP: cleanup algebraicconn: tracemin_fiedler. * Typo. * Finish reviewing algebraicconnectivity. * Convert bethe_hessian matrix to use sparse arrays. * WIP: update laplacian. Update undirected laplacian functions. * WIP: laplacian - add comment about _transition_matrix return types. * Finish laplacianmatrix review. * Update attrmatrix. * Switch to official laplacian function. * Update pagerank to use sparse array. * Switch bipartite matrix to sparse arrays. * Check from_scipy_sparse_matrix works with arrays. Modifies test suite. * Apply changes from review. * Fix failing docstring tests. * Fix missing axis for in-place multiplication. * Use scipy==1.8rc2 * Use matrix multiplication * Fix PyPy CI * [MRG] Create plot_subgraphs.py example (#5165) * Create plot_subgraphs.py https://github.com/networkx/networkx/issues/4220 * Update plot_subgraphs.py black * Update plot_subgraphs.py lint plus font_size * Update plot_subgraphs.py added more plots * Update plot_subgraphs.py removed plots from the unit test and added comments * Update plot_subgraphs.py lint * Update plot_subgraphs.py typos fixed * Update plot_subgraphs.py added nodes to the plot of the edges removed that was commented out for whatever reason * Update plot_subgraphs.py revert the latest commit - the line was commented out for a reason - it's broken * Update plot_subgraphs.py fixed node color issue * Update plot_subgraphs.py format fix * Update plot_subgraphs.py forgot to draw the nodes... now fixed * Fix sphinx warnings about heading length. * Update examples/algorithms/plot_subgraphs.py * Update examples/algorithms/plot_subgraphs.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu> * Add traveling salesman problem to example gallery (#4874) Adds an example of the using Christofides to solve the TSP problem to the example galery. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Fixed inconsistent documentation for nbunch parameter in DiGraph.edges() (#5037) * Fixed inconsistent documentation for nbunch parameter in DiGraph.edges() * Resolved Requested Changes * Revert changes to degree docstrings. * Update comments in example. * Apply wording to edges method in all graph classes. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Compatibility updates from testing with numpy/scipy/pytest rc's (#5226) * Rm deprecated scipy subpkg access. * Use recwarn fixture in place of deprecated pytest pattern. * Rm unnecessary try/except from tests. * Replace internal `close` fn with `math.isclose`. (#5224) * Replace internal close fn with math.isclose. * Fix lines in docstring examples. * Fix Python 3.10 deprecation warning w/ int div. (#5231) * Touchups and suggestions for subgraph gallery example (#5225) * Simplify construction of G with edges rm'd * Rm unused graph attribute. * Shorten categorization by node type. * Simplify node coloring. * Simplify isomorphism check. * Rm unit test. * Rm redundant plotting of each subgraph. * Use new package name (#5234) * Allowing None edges in weight function of bidirectional Dijkstra (#5232) * added following feature also to bidirectional dijkstra: The weight function can be used to hide edges by returning None. * changed syntax for better readability and code duplicate avoidance Co-authored-by: Hohmann, Nikolas <nikolas.hohmann@tu-darmstadt.de> * Add an FAQ about assigning issues. (#5182) * Add FAQ about assigning issues. * Add note about linking issues from new PRs. * Update dev deps (#5243) * Update minor doc issues with tex notation (#5244) * Add FutureWarnings to fns that return sparse matrices - biadjacency_matrix. - bethe_hessian_matrix. - incidence_matrix. - laplacian functions. - modularity_matrix functions. - adjacency_matrix. * Add to_scipy_sparse_array and use it everywhere. Add a new conversion function to preserve array semantics internally while not altering behavior for users. Also adds FutureWarning to to_scipy_sparse_matrix. * Add from_scipy_sparse_array. Supercedes from_scipy_sparse_matrix. * Handle deprecations in separate PR. * Fix docstring examples. Co-authored-by: Mridul Seth <mail@mriduls.com> Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com> Co-authored-by: Andrew Knyazev <andrew.knyazev@ucdenver.edu> Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: eskountis <56514439+eskountis@users.noreply.github.com> Co-authored-by: Anutosh Bhat <87052487+anutosh491@users.noreply.github.com> Co-authored-by: NikHoh <nikhoh@web.de> Co-authored-by: Hohmann, Nikolas <nikolas.hohmann@tu-darmstadt.de> Co-authored-by: Sultan Orazbayev <contact@econpoint.com> Co-authored-by: Mridul Seth <mail@mriduls.com>
* Compatibility updates from testing with numpy/scipy/pytest rc's (#5226)Ross Barnowski2021-12-121-1/+1
| | | | | | | * Rm deprecated scipy subpkg access. * Use recwarn fixture in place of deprecated pytest pattern. * Rm unnecessary try/except from tests.
* Investigate pre-release test failures (#5208)Ross Barnowski2021-12-032-33/+14
| | | | | | | * Use array ops for distance calculation. Removes for-loops and matmul. * Refactor spiral layout equidist to use arrays.
* xfail pydot tests. (#5187)Ross Barnowski2021-11-181-0/+1
|
* Add Mypy type checking infrastructure (#5127)Ross Barnowski2021-11-171-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add minimal mypy configuration file. * Add mypy workflow to GH. * Properly import sentinels from traversal.edgedfs. * mypy doesn't like variables named \"e\". * Rm annotations from single function. * Fix name collisions in test suite. Make sure all tests have unique names. * Rm unused random seed in test setup. * Rm redundant __all__ specification. * Silence mypy error from sum(). Mypy bug? * Fix tsp test instantiation nit. * \"type: ignore\" to suppress conditional fn sigature errors. * Remaining \"type: ignore\" to appease mypy. * Configure mypy to ignore inheritance issues. * Update exclude conf for CI. - Add yaml - Reformat regex containing reportviews * Rm partial annotations from lukes.py. Fixes mypy errors due to unannotated code. * Reorg defaultdict to reduce type: ignore cruft. * Homogenize signatures for fns defined in conditionals. * err as varname only in exception catching. * Fix name collision in Bellman-Ford test suite.
* Rm passing ax.transOffset to LineCollection. (#5173)Ross Barnowski2021-11-061-1/+0
| | | | In principle, ax.transOffset is not necessary and causes problems with matplotlib 3.5.0rc1 - see gh-5167.
* Bugfix for issue 5123 (#5153)Daniel Haden2021-11-032-1/+13
| | | | | | | | | * fixed bug in multipartite_layout so subset labels can be non-numeric * Added non-numeric partition label test to test_multipartite_layout. * moved multipartite non-numeric partition label test outside of main test class Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Add option for arrowsize to be a list (#5154)Dimitrios Papageorgiou2021-10-272-4/+37
| | | | | | The arrowsize param to draw_networkx_edges can now be a list of values, one value per edge. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update nx_pylab drawing edge color and width tests (#5134)Ross Barnowski2021-10-251-73/+233
| | | | | | | | | | | | | | | | | | | | | | | * Paremtrize edge color default. * Simplify. * Add tests for single edge_color. * Add test of edge_color tuple interpretation. * Parametrize single-edge_color tests on edgelist. * Add tests for num ec gt or lt num edges. * Rm redundant tests. * Factor out global alpha test. * Factor out tests for edges w/ single line width. * Factor out tests of linewidth as a sequence. * Refactor edge cmap scaling test.
* Drop Py37 (#5143)Jarrod Millman2021-10-231-6/+4
| | | | | | | | | | | | | | | | | | | * Drop Py37 * XML serialization issue * Use math.comb Co-authored-by: Simone Gasperini <simone.gasperini2@studio.unibo.it> * Run pyupgrade --py38-plus * Run black * More documentation * Deprecate euclidean Co-authored-by: Simone Gasperini <simone.gasperini2@studio.unibo.it>