geoml.viz
Export rather than drawing: each of these writes something another tool
renders. The containers’ own as_pyvista methods are documented with
the containers; what lives here is what those exports need
around them.
Diagrams
to_dot writes a model or a latent network as a Graphviz DOT diagram —
nodes for inputs, latent variables and variables, edges for the wiring, and
a shared node drawn once, which the printed tree cannot show. The module
imports nothing: Graphviz is needed to render the text, never to write it.
Models and latent networks as Graphviz diagrams.
This module writes a DOT description and stops there, the way plotly builds a figure and leaves the drawing to someone else: nothing is imported, so Graphviz is needed to look at a diagram but never to produce one. Render it with
dot -Tpng network.dot -o network.png
or paste it into any Graphviz viewer.
A diagram carries what the printed tree cannot: which node feeds which, once, for a node shared by several branches. Boxes are coloured by the part they play – the coordinates that go in, the latent nodes, the warpings on the way out, and the variables that come out – and every edge is labelled with the number of variables travelling along it.
- geoml.viz.graphviz.to_dot(obj, legend=True, rankdir='BT')[source]
Writes a model or a latent network as a Graphviz DOT description.
- Parameters:
obj – A VGPNetwork from the models module, or any node from the latent module. A model is drawn whole – coordinates, latent network, warpings and output variables; a node is drawn with everything that feeds it.
legend (bool) – Whether to include the legend.
rankdir (str) – Direction of flow, in Graphviz’s terms. The default “BT” puts the coordinates at the bottom and the variables on top.
- Returns:
dot (str) – The diagram, to save to a .dot file or hand to a Graphviz viewer.
PyVista
Plotly
- geoml.viz.plotly.categorical_points_3d(coordinates, values, colors, **kwargs)[source]
Visualization of categorical data.
- Parameters:
coordinates (ndarray) – The 3D coordinates.
values (ndarray, Series) – The categories to plot.
colors (dict) – Dictionary mapping the data labels to plotly color specifications.
kwargs – Additional arguments passed on to plotly’s scatter3d function.
- Returns:
out (list) – A singleton list containing the data to plot in plotly’s format.