Skip to content

Commit 59ed0cf

Browse files
dschultLucaCappelletti94MridulSrossbar
authored
Create a Tikz latex drawing feature for networkx (#6238)
* 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>
1 parent 814b295 commit 59ed0cf

5 files changed

Lines changed: 876 additions & 1 deletion

File tree

doc/developer/about_us.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ to add your name to the bottom of the list.
145145
- Philip Boalch
146146
- Matt Schwennesen, Github: `mjschwenne <https://github.com/mjschwenne>`_
147147
- Andrew Knyazev, Github: `lobpcg <https://github.com/lobpcg>`_, LinkedIn: `andrew-knyazev <https://www.linkedin.com/in/andrew-knyazev>`_
148+
- Luca Cappelletti, GitHub: `LucaCappelletti94 <https://github.com/LucaCappelletti94>`_
148149
- Sultan Orazbayev, GitHub: `SultanOrazbayev <https://github.com/SultanOrazbayev>`_, LinkedIn: `Sultan Orazbayev <https://www.linkedin.com/in/sultan-orazbayev/>`_
149150

150151
A supplementary (but still incomplete) list of contributors is given by the

doc/reference/drawing.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,14 @@ Graph Layout
9595
spectral_layout
9696
spiral_layout
9797
multipartite_layout
98-
98+
99+
100+
LaTeX Code
101+
==========
102+
.. automodule:: networkx.drawing.nx_latex
103+
.. autosummary::
104+
:toctree: generated/
105+
106+
to_latex_raw
107+
to_latex
108+
write_latex

networkx/drawing/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# graph drawing and interface to graphviz
22

33
from .layout import *
4+
from .nx_latex import *
45
from .nx_pylab import *
56
from . import nx_agraph
67
from . import nx_pydot

0 commit comments

Comments
 (0)