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

geoml.viz.pyvista.structure_discs(coordinates, dip, azimuth, size=1, **kwargs)[source]
geoml.viz.pyvista.camera_orbit(center, radius, height=None, n=20)[source]

Plotly

geoml.viz.plotly.aspect_ratio_2d(vertical_exaggeration=1)[source]
Return type:

dict

geoml.viz.plotly.aspect_ratio_3d(bounding_box, vertical_exaggeration=1)[source]
Return type:

dict

geoml.viz.plotly.bounding_box_3d(bounding_box, **kwargs)[source]
geoml.viz.plotly.planes_3d(coordinates, dip, azimuth, size=1, **kwargs)[source]
geoml.viz.plotly.arrows_3d(coordinates, directions, size=1, **kwargs)[source]
geoml.viz.plotly.numeric_points_3d(coordinates, values, **kwargs)[source]
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.

geoml.viz.plotly.isosurface(verts, faces, values=None, **kwargs)[source]
geoml.viz.plotly.segments_3d(coordinates, labels, colors, **kwargs)[source]
geoml.viz.plotly.numeric_section_3d(gridded_x, gridded_y, gridded_z, values, **kwargs)[source]
geoml.viz.plotly.mpl_to_plotly(cmap, level)[source]