zensols.calamr.render namespace¶
Submodules¶
zensols.calamr.render.base module¶
Renderer AMR graphs.
- class zensols.calamr.render.base.GraphRenderer(browser_manager, extension, rooted=True, visual_style=<factory>, sleep=0)[source]¶
Bases:
ABC
Renders an igraph in to a file and then displays it. To render the graph, use
render()
. Then you can display it withshow()
.The implementation of rendering is done in subclasses.
- __init__(browser_manager, extension, rooted=True, visual_style=<factory>, sleep=0)¶
-
browser_manager:
BrowserManager
¶ Detects and controls the screen.
- display(out_file)[source]¶
Display the graph generated in file
out_file
.- Parameters:
out_file (
Path
) – the graph to display
- display_all(out_files)[source]¶
Like
display()
but display several files at once. In some cases, this means a separate browser window with multiple tabs with just the selected graphs will be shown.
- render_to_file(context, out_file)[source]¶
Render graph the graph.
- Parameters:
context (
RenderContext
) – contains everything that is needed to render a graph
- class zensols.calamr.render.base.RenderContext(doc_graph, heading=None, visual_style=None)[source]¶
Bases:
Dictable
Contains everything that is needed to render a graph.
- __init__(doc_graph, heading=None, visual_style=None)¶
- doc_graph: DocumentGraph¶
The graph to render.
- heading: str = None¶
The title to use as the heading.
- visual_style: Dict[str, Any] = None¶
Any overriding context for the renderer.
- class zensols.calamr.render.base.rendergroup(renderer, graph_id='graph', display=True, directory=None)[source]¶
Bases:
object
A context manager to render several graphs at a time, then optionally display them. Rendering graphs is done by calling an instance of this context manager.
Example:
with rendergroup(self.renderer) as render: render(graph, heading='Source Max flow')
- __init__(renderer, graph_id='graph', display=True, directory=None)[source]¶
Initialize the context manager.
- Parameters:
renderer (
GraphRenderer
) – used to render the graphs and optionally display usingRenderer.display_all()
graph_id (
str
) – a unique identifier prefixed to files generated if none provided in the call methoddisplay (
bool
) – whether to display the files after generateddirectory (
Path
) – the directory to create the files in place of the temporary directory; if provided the directory is not removed after the graphs are rendered
zensols.calamr.render.graphvis module¶
Renderer AMR graphs using graphviz
.
- class zensols.calamr.render.graphvis.GraphVisGraphRenderer(browser_manager, extension='pdf', rooted=True, visual_style=<factory>, sleep=0)[source]¶
Bases:
GraphRenderer
A graph renderer using
graphviz.Digraph
.- __init__(browser_manager, extension='pdf', rooted=True, visual_style=<factory>, sleep=0)¶
zensols.calamr.render.plotly module¶
Renderer AMR graphs using plotly
.
- class zensols.calamr.render.plotly.PlotlyGraphRenderer(browser_manager, extension='html', rooted=True, visual_style=<factory>, sleep=0)[source]¶
Bases:
GraphRenderer
Render teh graph in plotly using a tree layout with each separated on the Z-axis. This makes it easier to see each component separately and easier to follow where the component alignment lie.
To do this, the components have to be detached from the connected bipartite graph to be rendered separately. The alignment edges are then rendered afterwward.
- __init__(browser_manager, extension='html', rooted=True, visual_style=<factory>, sleep=0)¶
zensols.calamr.render.pyvis module¶
Renderer AMR graphs using pyvis
.
- class zensols.calamr.render.pyvis.PyvisGraphRenderer(browser_manager, extension='html', rooted=True, visual_style=<factory>, sleep=0)[source]¶
Bases:
GraphRenderer
A graph renderer using the
pyvis.network.Network
API.- __init__(browser_manager, extension='html', rooted=True, visual_style=<factory>, sleep=0)¶
zensols.calamr.render.util module¶
Utilities such as gradient color generators.