Graphviz#

Inheritance Diagram#

If you use sphinx.ext.inheritance_diagram to generate inheritance diagrams with sphinx.ext.graphviz, and you output the inheritance diagrams in SVG format, they will automatically adapt to this theme’s light or dark mode.

To have the inheritance-diagram render to SVG, inside conf.py, you need the following option.

# conf.py
...
graphviz_output_format = 'svg'
...

Below is an example of the inheritance diagram for matplotlib.figure.Figure. Try toggling light/dark mode to see it adapt!

digraph inheritance9e891cb219 { bgcolor=transparent; fontsize=14; rankdir=LR; ratio=compress; size="8.0, 12.0"; "matplotlib.artist.Artist" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for objects that render into a FigureCanvas."]; "matplotlib.figure.Figure" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="The top level container for all the plot elements."]; "matplotlib.figure.FigureBase" -> "matplotlib.figure.Figure" [arrowsize=0.5,style="setlinewidth(0.5)"]; "matplotlib.figure.FigureBase" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Base class for `.Figure` and `.SubFigure` containing the methods that add"]; "matplotlib.artist.Artist" -> "matplotlib.figure.FigureBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

See the sphinx inheritance-diagram documentation for more information.