Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa1ae8d

Browse filesBrowse files
committed
Improve inheritance diagrams
When Graphviz is given a page size (which Sphinx does by default), it will layout the whole graph, and then scale the _entire_ thing down to fit. This means that text and lines on large diagrams are inconsistent with ones that fit. Additionally, the default size is larger than the content width which means the browser will also scale the image down a bit. But the URL map is _not_ scaled down, so the links will appear in the wrong spot. To fix this, set the page size in Graphviz very large, and make the diagram scrollable with CSS. Plus a few minor tweaks to font and line sizes now that images are a consistent scale.
1 parent ab3d63d commit aa1ae8d
Copy full SHA for aa1ae8d

File tree

Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed

‎doc/_static/mpl.css

Copy file name to clipboardExpand all lines: doc/_static/mpl.css
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,13 @@ table.property-table td {
9999
display: inline-block;
100100
margin: 0 0.5em;
101101
}
102+
103+
/* Make inheritance images have a scroll bar if necessary. */
104+
div.graphviz {
105+
border: 1px solid lightgrey;
106+
max-height: 50em;
107+
overflow: auto;
108+
}
109+
img.graphviz.inheritance {
110+
max-width: none;
111+
}

‎doc/conf.py

Copy file name to clipboardExpand all lines: doc/conf.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,12 @@ def js_tag_with_cache_busting(js):
619619

620620
numpydoc_show_class_members = False
621621

622-
inheritance_node_attrs = dict(fontsize=16)
622+
# We want to prevent any size limit, as we'll add scroll bars with CSS.
623+
inheritance_graph_attrs = dict(dpi=100, size='1000.0', splines='polyline')
624+
# Also remove minimum node dimensions, and increase line size a bit.
625+
inheritance_node_attrs = dict(height=0.02, margin=0.055, penwidth=1,
626+
width=0.01)
627+
inheritance_edge_attrs = dict(penwidth=1)
623628

624629
graphviz_dot = shutil.which('dot')
625630
# Still use PNG until SVG linking is fixed

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.