molfoundry.GraphPrinter#
- class molfoundry.GraphPrinter#
- property drawMode: DrawMode#
DrawMode.Mol(default) orDrawMode.Circles.- Type:
The depiction style
- property darkMode: DarkMode#
DarkMode.Dynamic(default, follow the page),DarkMode.On(dark), orDarkMode.Off(light).- Type:
The theme
- property withIndex: bool#
Label each drawn vertex with its id (default
False), as in MØD.A graph vertex shows its id, a rule vertex its rule node id. In a derivation’s DPO diagram the rule panels (L, K, R) show rule node ids and the graph panels (G, D, H) each vertex’s id in its own educt.
- property withExternalId: bool#
Append each vertex’s external id to its label, as
C:5, in every draw mode (defaultFalse).External ids are a SMILES atom map, a GML node id, or one set with
Vertex.setExternalId(). Which hydrogens are drawn is stillcollapseHydrogensalone, whether they have an external id or not.
- property drawStyle: DrawStyle#
DrawStyle.Default(precise, the default) orDrawStyle.xkcd(hand-drawn: wobbly strokes + Humor-Sans glyph outlines).Applies to graph, rule, DPO and derivation-graph rendering that uses this printer, e.g.
printer.drawStyle = DrawStyle.xkcd.- Type:
The rendering style
- property layout: GraphLayout#
The layout engine used when a depiction is positioned:
GraphLayout.Mol(chemistry-aware, the default) orGraphLayout.Force(force-directed).Applies to graph and rule rendering that uses this printer, e.g.
printer.layout = GraphLayout.Force.
- pushVertexOverlay(f)#
Push a per-vertex overlay resolver. When a graph — or a DG vertex’s molecule — is drawn, each atom’s marker is the first non-
Noneresult, trying the most recently pushed resolver first; returnNonefor vertices you do not want to mark. MirrorsDGPrinter’spushVertexColor/pushVertexLabel.Example (tag carbons with an origin color and id):
printer.pushVertexOverlay( lambda v: VertexOverlay(color=origin_color(v), label=v.id) if v.stringLabel == "C" else None )
- Parameters:
f (Callable[[Vertex], Optional[VertexOverlay]])
- Return type:
None
- popVertexOverlay()#
Pop the most recently pushed vertex overlay resolver.
- Return type:
None