jax_sn.tools.plotly module¶
Plotly functions for visualizing domains, solutions, elements, quadrature sets, and the derivation graphs the builders are written in.
Used by docs for interactive visualization; not a core part of the library and not eagerly imported.
- plot_1d_solution(solution_domain, solution, *, reference=None, n_points_per_element=20, n_reference_points=200, solution_names=None, reference_name="Analytical", colors=None, xaxis_title="x", yaxis_title="ψ", width=one, height=one))[source]¶
Plot one or more DG solution profiles on a 1D SolutionDomain, optionally against a continuous analytical reference curve. Each element is sampled and drawn independently (see _dg_element_profile) so that jumps across element faces render as real gaps in the line, instead of SolutionDomain.interpolate on a shared grid, which would silently connect across the discontinuity.
- Parameters:
solution_domain (jax_sn.solution_domain.SolutionDomain) – Must be 1D (solution_domain.dimension == 1).
solution (jnp.ndarray [n_elements, n_basis] or [n_solutions, n_elements, n_basis]) – One or more solution coefficient arrays (e.g. psi from a transport-operator solve).
reference (Callable[[jnp.ndarray], jnp.ndarray], optional) – A closed-form reference, called as reference(x) with x of shape [n_reference_points, 1] and expected to return values broadcastable to [n_reference_points]; drawn as a continuous dashed black line (analytical solutions have no element-wise discontinuities to preserve, so they’re sampled on one shared dense grid instead of per element).
n_points_per_element (int) – Points sampled per element for each solution row.
n_reference_points (int) – Points sampled (uniformly over the domain’s vertex extent) for reference.
solution_names (Sequence[str], optional) – Legend label per row of solution; defaults to “Numerical” for a single profile, else “solution {i}”.
reference_name (str) – Legend label for reference.
colors (Sequence[str], optional) – Colour palette to cycle through per solution profile; defaults to plotly’s qualitative Plotly palette.
xaxis_title (str) – Axis labels.
yaxis_title (str) – Axis labels.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_2d_solution(solution_domain, solution, *, n_subdivisions=4, colorscale="Viridis", colorbar_title="ψ", show_element_boundaries=alse, elevate=alse, z_scale=.0, zmin=None, zmax=None, xaxis_title="x", yaxis_title="y", zaxis_title="ψ", show_domain_mesh=False, show_domain_mesh_boundaries=True, color_by_material=True, domain_mesh_colors=None, material_names=None, domain_mesh_opacity=0.6, angle=None, width=None, height=None)[source]¶
Plot a DG solution field on a 2D SolutionDomain as a colour map, shaded smoothly within each element and discontinuous across element faces (see _dg_element_field_2d).
- z
Rendered as a Mesh3d – plotly has no native “coloured triangle mesh” trace outside its 3D scene types, but Mesh3d’s per-vertex (intensitymode=”vertex”) colouring does exactly the Gouraud-shaded triangle fill a colour map needs, so it’s reused here. By default (elevate=False) the mesh is flat (z=0) and the camera is locked to a top-down orthographic view, so it reads as a plain 2D colour map; the scene can still be freely rotated/zoomed like any other plotly 3D plot. With elevate=True, z is solution itself (still colour-mapped the same way), giving an actual height-field surface – the only way a 3D view of a 2D field is informative rather than a flat plane seen edge-on – and the camera switches to a normal angled 3D view instead.
- solution_domainjax_sn.solution_domain.SolutionDomain
Must be 2D (solution_domain.dimension == 2).
- solutionjnp.ndarray [n_elements, n_basis]
One solution coefficient array (e.g. psi from a transport-operator solve, for one angle/energy-group).
- n_subdivisionsint
Sub-triangles per element per side (see _reference_triangle_subdivision); 1 is exact for a P1 field, higher values give a smoother-looking gradient/surface for higher-degree fields at the cost of a bigger mesh.
- colorscalestr or list
Plotly colourscale name (or explicit scale) for solution’s values.
- colorbar_titlestr
Title of the colour bar.
- show_element_boundariesbool
Overlay a black wireframe along element edges (following the surface when elevate=True).
- show_domain_meshbool
Draw solution_domain.domain’s mesh, coloured by material exactly like plot_domain (same _color/qualitative-palette scheme), as a flat floor beneath the solution surface – at z=0 when elevate=False (partially transparent, so it still shows through/around the solution surface sitting right on top of it) or just below the surface’s lowest point when elevate=True (so the surface visibly floats above its own geometry/material footprint).
- show_domain_mesh_boundariesbool
On top of the floor itself, also overlay a black wireframe along its element edges (every triangle’s 3 edges, so a shared interior edge between two same-material elements is still drawn – consistent with show_element_boundaries elsewhere in this module). Ignored unless show_domain_mesh=True.
- color_by_material, domain_mesh_colors, material_namesoptional
Forwarded to the floor’s material colouring; see plot_domain’s parameters of the same name. Ignored unless show_domain_mesh=True.
- domain_mesh_opacityfloat
Opacity of the floor mesh. Ignored unless show_domain_mesh=True.
- anglejnp.ndarray, optional
If given (a direction [n_dim], as passed to e.g. plot_domain’s graph_angle), draws a small red “Angle” compass arrow (see _add_angle_compass) at the domain’s corner, sitting at the same baseline height as the floor (whether or not show_domain_mesh is actually on).
- elevatebool
If True, plot solution as height (z) as well as colour, and switch to an angled 3D camera. If False (default), z=0 for every point and the camera is a locked top-down view, i.e. a flat colour map.
- z_scalefloat
Multiplies solution before using it as z, when elevate=True. Vertical exaggeration for fields whose value range is small relative to the domain’s spatial extent; ignored when elevate=False.
- zmin, zmaxfloat, optional
Colour scale bounds (and, when elevate=True, the z-axis range before z_scale); left None (default), plotly scales to solution’s min/max.
- xaxis_title, yaxis_title, zaxis_titlestr
Axis labels; zaxis_title only shown when elevate=True (the z axis is hidden otherwise).
- width, heightint, optional
Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
fig : plotly.graph_objects.Figure
- plot_domain(domain, *, color_by_material=True, show_element_boundaries=True, show_material_interfaces=True, colors=None, material_names=None, show_graph=False, graph_angle=None, show_levels=False, level_mode='order', show_element_numbers=False, graph_color='darkred', mesh_opacity=1.0, width=None, height=None)[source]¶
Visualize a Domain’s mesh with plotly, dispatching on domain.vertices.shape[1].
1D: a line with a marker at each vertex.
2D: every triangle drawn as a filled polygon.
3D: the tetrahedral mesh’s boundary surface (exterior faces only, plus internal material-interface faces when show_material_interfaces is set) drawn with Mesh3d.
- Parameters:
domain (jax_sn.domain.GeometricDomain) – The domain to visualize. Needs cross_sections_indexed when color_by_material=True.
color_by_material (bool) – Colour elements by domain.cross_sections_indexed.indices, one legend entry (and plotly trace/trace-group) per distinct material. If False, the whole domain is drawn in a single colour and show_material_interfaces has no effect.
show_element_boundaries (bool) – Overlay element boundaries: a vertical tick at every vertex in 1D, a black wireframe in 2D/3D.
show_material_interfaces (bool) – 3D only: in addition to the domain’s exterior boundary, also draw the internal faces between two differently-tagged materials, so material regions are visible inside a volumetric mesh rather than only the outer box. Ignored outside 3D and when color_by_material is False.
colors (Sequence[str], optional) – Colour palette to cycle through per material/group; defaults to plotly’s qualitative Plotly palette.
material_names (Mapping[int, str] or Sequence[str], optional) – Display name per material index, used as the legend label instead of f”material {{index}}” – either a {index: name} mapping (sparse; unmapped indices still fall back to f”material {{index}}”) or a sequence indexed positionally by material index.
show_graph (bool) – Overlay the element-adjacency graph: a graph_color circle at every element centroid, connected to its neighbours.
graph_angle (jnp.ndarray, optional) – If given (a direction [n_dim]), show_graph’s edges are the directed sweep- dependency graph for that angle (upstream -> downstream, from jax_sn.domain.graph_generation.compute_face_inflow), with an arrowhead at each edge’s midpoint and a small “Angle” legend entry – a compass arrow just outside the domain showing the angle itself, separate from the per-edge arrowheads. If None (default), edges are the plain undirected etoe adjacency and no compass arrow is drawn. Also required (non-None) when show_levels=True, since levels are angle-dependent. Ignored when both show_graph and show_levels are False.
show_levels (bool) – Label every element with a number from level_mode. Requires graph_angle to be given (both modes are angle-dependent).
level_mode ({"levels", "order"}) – What show_levels labels each element with. “levels”: its sweep level – the topological-sort group from jax_sn.domain.graph_generation.compute_levels_domain_safe for graph_angle (elements in the same level are mutually independent and solvable in parallel, so this repeats across a level). “order”: its own position in the topological sort (0 = computed first, ties within a level broken by element index) – the actual sequential order a serial sweep computes elements in, matching how BasicSweepData.levels_argsort is built for a single angle (see _element_topological_order).
show_element_numbers (bool) – Label every element with its own index (0..n_elements-1, matching row order in domain.connectivity), in the same white/graph_color-outlined circle style as show_levels – but angle-independent, so it works with no graph_angle and needs no sweep computation. Independent of show_graph/show_levels; if more than one of these labelling options is set, show_element_numbers wins.
graph_color (str) – Colour for everything drawn by show_graph/show_levels/show_element_numbers (edges, arrowheads, node outlines/labels) – kept a single fixed accent, distinct from the mesh’s black element boundaries, so a dense adjacency graph doesn’t visually merge into the mesh underneath it.
mesh_opacity (float) – Opacity (0-1) applied to the underlying mesh (fill and/or boundary lines/wireframe) only – the graph/level overlay is unaffected. Lower it (e.g. 0.25-0.4) to fade a crowded mesh out of the way when show_graph/show_levels/show_element_numbers is the point of the plot.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container, which – combined with 2D/3D’s fixed-aspect axes (scaleanchor=”y” / aspectmode=”data”) – tends to letterbox a domain whose bounding box isn’t near-square (wide flat mesh in a wide-but-short default figure, leaving dead vertical margin). Set both explicitly to match the domain’s aspect ratio and reclaim that space.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container, which – combined with 2D/3D’s fixed-aspect axes (scaleanchor=”y” / aspectmode=”data”) – tends to letterbox a domain whose bounding box isn’t near-square (wide flat mesh in a wide-but-short default figure, leaving dead vertical margin). Set both explicitly to match the domain’s aspect ratio and reclaim that space.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_element_basis_functions(element, *, mode='auto', n_subdivisions=10, n_points_1d=200, colors=None, opacity=0.55, colorscale='Viridis', colorbar_title='H_i', node_color='black', active_node_color='red', show_vertical_guides=True, width=None, height=None)[source]¶
Visualize a Lagrangian element’s basis functions H_i and their nodes x_i on the reference cell.
1D: each H_i is drawn as a curve over the reference interval [0, 1]. 2D: as an elevated surface over the reference triangle (mirroring plot_2d_solution’s elevate=True style, reusing the same _reference_triangle_subdivision). In both cases every node is drawn as a marker at its own H_i value (1 for the active node, ~0 for the rest – taken from the same tabulation as the curve/surface, not hard-coded).
- Parameters:
element (jax_sn.solution_domain.basix_fem.BasixLagrangianSimplex) – A 1D or 2D Lagrangian simplex element (element.dimension in (1, 2)).
mode ({"auto", "all", "slider"}) – “all”: every basis function drawn simultaneously, each its own colour/legend entry with a marker at its own peak node – clear in 1D, where curves rarely overlap confusingly. “slider”: one basis function shown at a time (stepped through with a slider), with every node drawn (the active one highlighted in active_node_color) – usually clearer in 2D, where several overlaid coloured/translucent elevated surfaces get visually busy fast, especially past a few basis functions. “auto” (default) picks “all” for a 1D element, “slider” for a 2D one.
n_subdivisions (int) – 2D only: sub-triangles per element per side used to sample the surface, see _reference_triangle_subdivision; higher values resolve the shape between nodes more smoothly for higher-degree elements.
n_points_1d (int) – 1D only: number of points densely sampled over [0, 1] to draw each curve.
colors (Sequence[str], optional) – mode=”all” only: colour palette to cycle through per basis function; defaults to plotly’s qualitative Plotly palette.
opacity (float) – 2D mode=”all” only: opacity of each overlaid surface.
colorscale (str or list) – 2D mode=”slider” only: Plotly colourscale for the basis function’s value.
colorbar_title (str) – 2D mode=”slider” only: colour bar title.
node_color (str) – mode=”slider” only: marker colour for inactive nodes and for the currently selected basis function’s own node.
active_node_color (str) – mode=”slider” only: marker colour for inactive nodes and for the currently selected basis function’s own node.
show_vertical_guides (bool) – 2D only: also draw a dashed vertical line from each node’s zero-plane dot up to z=1.0 (the 2D counterpart of the 1D guide, always drawn there). The reference cell’s outline and a black dot per node on the z=0 plane are always drawn in 2D regardless of this flag.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_quadrature_set(quadrature_set, *, values=None, colorbar_title=None, color_by_weight=True, colorscale='Viridis', cmin=None, cmax=None, marker_size=6, ray_color='lightgray', show_unit_sphere=False, width=None, height=None)[source]¶
Plot a QuadratureSetBase’s angles as points on the unit sphere, each joined to the origin by a line so it reads as a direction/ray rather than a bare point.
- Parameters:
quadrature_set (jax_sn.quadrature_set.QuadratureSetBase) – Any quadrature set; only .angles ([n_angles, 3]) and (unless values is given) .weights ([n_angles]) are used.
values (jnp.ndarray [n_angles], optional) – Colour each point by these values instead of the quadrature weights – e.g. some function evaluated at the quadrature’s angles. Overrides color_by_weight.
colorbar_title (str, optional) – Colour bar title; defaults to “w” for weights, or “f” when values is given.
color_by_weight (bool) – Colour each point by its quadrature weight (with a colour bar) instead of a single flat colour. Ignored when values is given (then always coloured).
colorscale (str or list) – Plotly colourscale name (or explicit scale) for the weights/values; ignored when neither is used for colouring.
cmin (float, optional) – Colour scale bounds; left None (default), plotly scales to the weights/values’ own min/max. Set both explicitly (e.g. to a shared, zero-centred range) to make colours comparable against another plot’s – e.g. plot_moments_spheres/plot_spherical_field’s.
cmax (float, optional) – Colour scale bounds; left None (default), plotly scales to the weights/values’ own min/max. Set both explicitly (e.g. to a shared, zero-centred range) to make colours comparable against another plot’s – e.g. plot_moments_spheres/plot_spherical_field’s.
marker_size (int) – Marker size in pixels.
ray_color (str) – Colour of the origin-to-angle lines.
show_unit_sphere (bool) – Overlay a faint unit sphere for reference.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_moments_bar(moments, l_max, *, colors=None, width=None, height=None)[source]¶
Bar chart of real-spherical-harmonic moment coefficients \(\phi_{lm}\) against the flattened \((l,m)\) index, shaded by degree \(l\).
- Parameters:
moments (jnp.ndarray [(l_max + 1)**2]) – Moment coefficients in the same \((l,m)\) ordering as jax_sn.quadrature_set.QuadratureSetBase.wk_ylm_real/ylm_real (see jax_sn.quadrature_set.quadrature_set_base._lm_real_expansion), e.g. from contracting a discrete field against QuadratureSetBase.wk_ylm_real(l_max).
l_max (int) – Maximum expansion degree moments was computed with.
colors (Sequence[str], optional) – Colour palette to cycle through per degree l; defaults to plotly’s qualitative Plotly palette.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_spherical_field(l_max, moments, *, n_theta=60, n_phi=120, colorscale="Viridis", colorbar_title="Σ φ_lm·Y_lm(Ω)", zm, zmin, zm, zmax, wi, width, height=None)[source]¶
Plot a real-spherical-harmonic expansion as a continuous field on the unit sphere, sampled on a fine (theta, phi) grid independent of any quadrature set – the continuous, “re-interpolated” counterpart to plot_quadrature_set’s discrete points.
- Parameters:
l_max (int) – Maximum expansion degree; moments must have (l_max + 1)**2 entries.
moments (jnp.ndarray [(l_max + 1)**2]) – Real-spherical-harmonic expansion coefficients, in the same ordering as QuadratureSetBase.wk_ylm_real/ylm_real (see _lm_real_expansion).
n_theta (int) – Grid resolution in the polar/azimuthal angle.
n_phi (int) – Grid resolution in the polar/azimuthal angle.
colorscale (str or list) – Plotly colourscale for the reconstructed field.
colorbar_title (str) – Colour bar title.
zmin (float, optional) – Colour scale bounds; left None (default), plotly scales to the field’s min/max.
zmax (float, optional) – Colour scale bounds; left None (default), plotly scales to the field’s min/max.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- plot_moments_spheres(moments, l_max, *, n_theta=16, n_phi=32, colorscale="RdBu_r", clim=None, radius=0.85, spacing=2.2, colorbar_title="φ_lm·Y_lm(Ω)", w, width=e, height=None)[source]¶
Visualize real-spherical-harmonic moments \(\phi_{lm}\) as a pyramid of small spheres – row \(l\), column \(m\) – each coloured by that term’s own contribution \(\phi_{lm} Y_{lm}(\Omega)\) on one shared, zero-centred colour scale. That shared scale is what makes both shape and relative size legible at a glance: a near-zero moment reads as a flat, faint sphere, a large one shows its harmonic’s lobed pattern vividly – the small-multiples analogue of plot_spherical_field’s single reconstructed field, one term at a time instead of their sum.
Each little sphere is still oriented in the same (x, y, z) convention as the discrete angles themselves (only translated to its grid slot), so the scene keeps (unticked, since the axis values are grid positions, not coordinates) x/y/z titles – letting the reader relate a lobe’s direction here back to the same direction in plot_quadrature_set/plot_spherical_field.
- Parameters:
moments (jnp.ndarray [(l_max + 1)**2]) – Moment coefficients, in the same ordering as plot_moments_bar/_lm_real_expansion.
l_max (int) – Maximum expansion degree.
n_theta (int) – Per-sphere grid resolution (kept low by default – there are (l_max + 1)**2 of these).
n_phi (int) – Per-sphere grid resolution (kept low by default – there are (l_max + 1)**2 of these).
colorscale (str or list) – Diverging Plotly colourscale; “RdBu” (default) makes positive/negative lobes easy to tell apart.
clim (float, optional) – Symmetric colour scale bound (cmin=-clim, cmax=clim); left None (default), it’s the largest |φ_lm·Y_lm(Ω)| over every term. Set explicitly to a shared value (e.g. matching plot_quadrature_set/plot_spherical_field’s own cmin/cmax) to make colours comparable across plots.
radius (float) – Radius of each small sphere; less than half of spacing leaves a visible gap between neighbours.
spacing (float) – Centre-to-centre distance between neighbouring (l, m) spheres.
colorbar_title (str) – Colour bar title.
width (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
height (int, optional) – Figure size in pixels; either/both may be given. Left None (default) plotly autosizes to its container.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure
- add_axis_triad(fig, origin=(0.0, 0.0, 0.0), length=1.0, colors=('red', 'green', 'blue'), labels=('x', 'y', 'z'), row=None, col=None)[source]¶
Draw a small PyVista/VTK-style XYZ orientation triad in a 3D scene – three colour-coded arrows from origin along the local +x/+y/+z directions, each tipped with a cone and text label. Meant as a direct replacement for Plotly’s own scene axes when those are hidden (e.g. because the axis values aren’t physically meaningful, as in plot_moments_spheres’s grid layout, or just to keep several scenes visually consistent) – a literal, always-legible direction marker instead of relying on axis lines/ticks that are easy to hide by accident and don’t stand out much even when shown.
- Parameters:
fig (plotly.graph_objects.Figure) – Modified in place (new traces appended).
origin (Sequence[float] [3]) – Where the triad’s three arrows start.
length (float) – Arrow length (shaft + cone).
colors (Sequence[str] [3]) – Colour per axis, in (x, y, z) order; default matches the common red/green/blue convention.
labels (Sequence[str] [3]) – Text label per axis, in (x, y, z) order.
row (int, optional) – Subplot cell to add the triad to (as for Figure.add_trace); omit for a non-subplot figure.
col (int, optional) – Subplot cell to add the triad to (as for Figure.add_trace); omit for a non-subplot figure.
- plot_derivation_graph(module, *, orientation='horizontal', highlight=None, stale_selector=False, show_projections=True, fade_shielded=True, colors=None, layer_gap=None, label_chars=14, font_size=10, node_size=15, width=800, height=700)[source]¶
Visualize the dependency graph a jax_sn.tools.parametrisation.ParametrisedModule declares – e.g. any rung of jax_sn.operator_creation.builders – with the class’s storage policy as its colouring.
Every node is a quantity or a primitive; every solid edge points from a dependency to what is built from it (a derivation’s parameter names are its dependencies). Nodes are laid out left to right (or top to bottom) in layers by longest path from a primitive, so an edge never points backwards – except a projection edge, which may, since a projection reads a quantity back out of a more-derived one that already holds it, and is bowed aside rather than drawn through the layers it skips. An edge spanning several layers is routed through the gaps between the layers it crosses instead of flying straight over them (see _route_long_edges), so no line passes through a node it has nothing to do with.
The colouring is what the class’s graph() says about storage: which primitives are still free to .updated(), which are pinned because something stored was built from them, and which quantities are stored as fields / projected out of a stored one / recomputed on every access. Since a stored or projected quantity is read rather than computed, the edges into it are inert here, and are faded out (fade_shielded) – what is left in full colour is exactly the work a fresh access actually does. Calling this on an abstract rung (which stores nothing) therefore shows the bare structure; calling it on Rung.varying(…) / .freezing(…) shows what that policy bought.
- Parameters:
module (type or ParametrisedModule) – A ParametrisedModule subclass or an instance of one (an instance is read as its class).
orientation ({"horizontal", "vertical"}) – “horizontal” (default) lays the layers out left to right, “vertical” top to bottom – easier to read in a notebook for a deep graph, since it scrolls rather than shrinks.
highlight (str or Sequence[str], optional) – One or more primitives to trace forward: they and everything downstream keep their colour, everything else greys out – i.e. exactly what .updated(**{primitive: …}) invalidates and rebuilds. A quantity name is rejected; only primitives can be updated.
stale_selector (bool) – Add a dropdown doing the same thing interactively, one entry per primitive plus “all”. Costs nothing at render time (every colouring is precomputed), so it survives being saved to a static HTML page, e.g. in the docs.
show_projections (bool) – Draw the PROJECTIONS edges (source -> projected quantity) as dotted arrows. Only visible when the class actually stores something to project out of.
fade_shielded (bool) – Fade the edges into a stored/projected quantity, which are not traversed on this class (see above). With False, every dependency edge is drawn identically – the plain registry.
colors (Mapping[str, str], optional) – Override colours per role; keys as in the legend (“free primitive”, “frozen primitive”, “stored”, “projected”, “derived”).
layer_gap (float, optional) – Spacing between layers, relative to the spacing between nodes within a layer. Raise it to pull crowded layers apart. Defaults to 1.0 horizontally and 1.8 vertically, where a label (drawn under its node) sits between two layers rather than beside them.
label_chars (int) – Label wrap width (in characters, broken at underscores), label font size, and marker size. Each label sits under its node in a white, black-bordered box drawn above every trace, so an edge passing behind it hides rather than garbling the text.
font_size (int) – Label wrap width (in characters, broken at underscores), label font size, and marker size. Each label sits under its node in a white, black-bordered box drawn above every trace, so an edge passing behind it hides rather than garbling the text.
node_size (int) – Label wrap width (in characters, broken at underscores), label font size, and marker size. Each label sits under its node in a white, black-bordered box drawn above every trace, so an edge passing behind it hides rather than garbling the text.
width (int, optional) – Figure size in pixels; defaults are derived from the graph’s shape (its number of layers and the size of its widest layer), which is usually a better starting point than plotly’s autosize for a graph this tall or wide. The default width is capped at a notebook-friendly 1150px, so a deep graph tightens rather than overflowing the page; raise it (and font_size with it) if the labels end up crowded.
height (int, optional) – Figure size in pixels; defaults are derived from the graph’s shape (its number of layers and the size of its widest layer), which is usually a better starting point than plotly’s autosize for a graph this tall or wide. The default width is capped at a notebook-friendly 1150px, so a deep graph tightens rather than overflowing the page; raise it (and font_size with it) if the labels end up crowded.
- Returns:
fig
- Return type:
plotly.graph_objects.Figure