8.2.7.1.1. _DspPlot¶
- class _DspPlot(sitemap=None, *args, engines=None, **kwargs)[source]¶
Methods
__delattr__Implement delattr(self, name).
__dir__Default dir() implementation.
__eq__Return self==value.
__format__Default object formatter.
__ge__Return self>=value.
__getattribute__Return getattr(self, name).
__getstate__Helper for pickle.
__gt__Return self>value.
__hash__Return hash(self).
__init_subclass__This method is called when a class is subclassed.
__iter__Yield the DOT source code line by line (as graph or subgraph).
__le__Return self<=value.
__lt__Return self<value.
__ne__Return self!=value.
__new____reduce__Helper for pickle.
__reduce_ex__Helper for pickle.
__repr__Return repr(self).
__setattr__Implement setattr(self, name, value).
__sizeof__Size of object in memory, in bytes.
__str__The DOT source code as string.
__subclasshook__Abstract classes can override this to customize issubclass().
_a_listReturn assembled DOT a_list string.
_attrReturn DOT node statement line.
_attr_listReturn assembled DOT attribute list string.
_attr_plain_commentReturn comment header line.
_copy_kwargsReturn the kwargs to create a copy of the instance.
_edgeReturn DOT digraph edge statement line.
_edge_plainReturn plain DOT edge statement line.
_get_filepathReturn
outfile.with_suffix('.gv')._get_formatReturn format inferred from outfile suffix and/or given
format._get_parameters_get_pipe_parameters_get_render_parameters_getattr_from_dictReturn self.attrname if attrname is in the instance dictionary (as oposed to on the type).
_headReturn DOT digraph head line.
_head_strictReturn DOT strict head line.
_mkdirsRecursively create directories up to the path of
filenameas needed._nodeReturn DOT node statement line.
_pipe_future_pipe_legacy_quoteReturn DOT identifier from string, quote if needed.
_quote_edgeReturn DOT edge statement node_id from string, quote if needed.
_repr_image_jpegReturn the rendered graph as JPEG bytes.
_repr_image_pngReturn the rendered graph as PNG bytes.
_repr_image_svg_xmlReturn the rendered graph as SVG string.
_repr_mimebundle_Return the rendered graph as IPython mimebundle.
_subgraphReturn DOT subgraph head line.
_subgraph_plainReturn plain DOT subgraph head line.
_verify_engine_verify_format_verify_formatter_verify_renderer_viewStart the right viewer based on file format and platform.
_view_darwinOpen filepath with its default application (mac).
_view_freebsdOpen filepath in the user's preferred application (linux, freebsd).
_view_linuxOpen filepath in the user's preferred application (linux, freebsd).
_view_windowsStart filepath with its associated application (windows).
attrAdd a general or graph/node/edge attribute statement.
clearReset content to an empty body, clear graph/node/egde_attr mappings.
copyReturn a copied instance of the object.
edgeCreate an edge between two nodes.
edgesCreate a bunch of edges.
nodeCreate a node.
pipeReturn the source piped through the Graphviz layout command.
Save the source to file and render with the Graphviz engine.
saveSave the DOT source to file.
subgraphAdd the current content of the given sole
graphargumentunflattenReturn a new
Sourceinstance with the sourceviewSave the source to file, open the rendered result in a viewer.
Attributes
__dict____weakref__list of weak references to the object
_default_extension_encoding_engine_formatter_jupyter_mimetype_pipe_linesSimplify
._pipe_lines()mocking._pipe_lines_stringSimplify
._pipe_lines_string()mocking._renderSimplify
._render()mocking._renderer_tail_unflattenSimplify ``._unflatten mocking.
directedTruedirectoryencodingThe encoding for the saved source file.
engineThe layout engine used for rendering (
'dot','neato', ...).filepathThe target path for saving the DOT source file.
formatThe output format used for rendering (
'pdf','png', ...).formatterThe output formatter used for rendering (
'cairo','gd', ...).rendererThe output renderer used for rendering (
'cairo','gd', ...).sourceThe generated DOT source code as string.
namestr: DOT source identifier for the
graphordigraphstatement.commentstr: DOT source comment for the first source line.
graph_attr~typing.Dict[str, str]: Attribute-value pairs applying to the graph.
node_attr~typing.Dict[str, str]: Attribute-value pairs applying to all nodes.
edge_attr~typing.Dict[str, str]: Attribute-value pairs applying to all edges.
body~typing.List[str]: Verbatim DOT source lines including final newline.
strictbool: Rendering should merge multi-edges.
filenamestr: Target file name for saving the DOT source file.
- _format = 'svg'¶
- render(*args, **kwargs)[source]¶
Save the source to file and render with the Graphviz engine.
- Args:
- filename: Filename for saving the source
(defaults to
name+'.gv').s
directory: (Sub)directory for source saving and rendering. view (bool): Open the rendered result
with the default application.
- cleanup (bool): Delete the source file
after successful rendering.
- format: The output format used for rendering
(
'pdf','png', etc.).- renderer: The output renderer used for rendering
(
'cairo','gd', …).- formatter: The output formatter used for rendering
(
'cairo','gd', …).
neato_no_op: Neato layout engine no-op flag. quiet (bool): Suppress
stderroutputfrom the layout subprocess.
- quiet_view (bool): Suppress
stderroutput from the viewer process (implies
view=True, ineffective on Windows platform).
outfile: Path for the rendered output file. engine: Layout engine for rendering
(
'dot','neato', …).- raise_if_result_exists: Raise
graphviz.FileExistsError if the result file exists.
- overwrite_source: Allow
dotto write to the file it reads from. Incompatible with
raise_if_result_exists.
- Returns:
The (possibly relative) path of the rendered file.
- Raises:
- ValueError: If
engine,format,renderer, orformatter are unknown.
- graphviz.RequiredArgumentError: If
formatteris given but
rendereris None.- ValueError: If
outfileis the same file as the source file unless
overwite_source=True.- graphviz.ExecutableNotFound: If the Graphviz
dotexecutable is not found.
- graphviz.CalledProcessError: If the returncode (exit status)
of the rendering
dotsubprocess is non-zero.
RuntimeError: If viewer opening is requested but not supported.
- ValueError: If
- Example:
>>> doctest_mark_exe() >>> import graphviz >>> dot = graphviz.Graph(name='spam', directory='doctest-output') >>> dot.render(format='png').replace('\\', '/') 'doctest-output/spam.gv.png' >>> dot.render(outfile='spam.svg').replace('\\', '/') 'doctest-output/spam.svg'
- Note:
The layout command is started from the directory of
filepath, so that references to external files (e.g.[image=images/camelot.png]) can be given as paths relative to the DOT source file.
- __annotations__ = {'directed': 'bool', 'directory': 'typing.Union[str, bytes]'}¶
- __doc__ = None¶
- __module__ = 'schedula.utils.drw.nodes'¶