Learn R Programming

grip (version 0.3.0)

layout.coords: Extract coordinates from a layout result

Description

Use one extraction step for ordinary layouts, traces, MDS fits, and supported refinement results. Existing return types and direct field access are unchanged.

Usage

layout.coords(x)

Value

The coordinate matrix, unchanged, including vertex order, dimensions, dimnames, and attributes. No projection, alignment, scaling, or scoring is performed. Malformed, ambiguous, or unsupported objects produce an error.

Arguments

x

A numeric coordinate matrix, a grip_layout_trace, a grip_gmds_layout, or a refinement list with the documented coords/trace/frames/prepared/score or coords/state/trace/frames structure.

Details

For traces the final frame is selected. For MDS and refinement fits the fitted coords are selected. A plain list containing only coords is not a recognized result; pass that matrix explicitly instead.

Keep graph vertex order when reusing coordinates. MDS result fields method, coords, diagnostics, and metadata remain directly available. Stopping information in metadata is method-dependent. Trace $final and refinement $coords remain supported. Prepared caches and internal state fields are version-dependent: rebuild them when the graph or package contract changes.

See Also

grip(), trace.grip(), classical.mds(), geodesic.kk()

Examples

Run this code
edges <- edges.path(6)
fits <- list(grip(edges, n = 6, dim = 2, seed = 1),
             trace.grip(edges, n = 6, dim = 2, seed = 1),
             classical.mds(edges = edges, n = 6))
first <- layout.coords(fits[[1]])
coords <- lapply(fits, layout.coords)
plot.layout(coords[[1]], edges = edges)
vapply(coords, function(z) score.layout(z, edges = edges, n = 6,
    sample.size.stress = 15, stress.seed = 1,
    edge.crossings = "never")$sampled.stress, numeric(1))

Run the code above in your browser using DataLab