Skip to content

Commit

Permalink
feat: use ratio="compress" and concentrate=true and ~1:1 aspect r…
Browse files Browse the repository at this point in the history
…atio in dot/graphviz (#293)

Co-authored-by: Konstantin <[email protected]>
  • Loading branch information
hf-kklein and Konstantin authored Nov 8, 2024
1 parent 196f421 commit fa7a046
Show file tree
Hide file tree
Showing 16 changed files with 1,573 additions and 1,484 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,5 @@ dmypy.json
# version number for rebdhuhn; gets auto-generated during the command
# python -m build
src/rebdhuhn/version.py

src/rebdhuhn/_version.py
13 changes: 12 additions & 1 deletion src/rebdhuhn/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@ def convert_graph_to_dot(ebd_graph: EbdGraph) -> str:
f'<B><FONT POINT-SIZE="18">{ebd_graph.metadata.chapter}</FONT></B><BR/><BR/>'
f'<B><FONT POINT-SIZE="16">{ebd_graph.metadata.section}</FONT></B><BR/><BR/><BR/><BR/>'
)
dot_attributes: dict[str, str] = {"labelloc": '"t"', "label": f"<{header}>"}

dot_attributes: dict[str, str] = {
# https://graphviz.org/doc/info/attrs.html
"labelloc": '"t"',
"label": f"<{header}>",
"ratio": '"compress"',
"concentrate": "true",
"pack": "true",
"rankdir": "TB",
"packmode": '"array"',
"size": '"20,20"', # in inches 🤮
}
dot_code = "digraph D {\n"
for dot_attr_key, dot_attr_value in dot_attributes.items():
dot_code += f"{ADD_INDENT}{dot_attr_key}={dot_attr_value};\n"
Expand Down
1,025 changes: 535 additions & 490 deletions unittests/__snapshots__/test_table_to_graph.ambr

Large diffs are not rendered by default.

68 changes: 34 additions & 34 deletions unittests/output/E_0003.dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fa7a046

Please sign in to comment.