bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / graph / _rag / show_rag
function
skimage.graph._rag:show_rag
source: /dev/scikit-image/src/skimage/graph/_rag.py :458
Signature
def show_rag ( labels , rag , image , border_color = black , edge_width = 1.5 , edge_cmap = magma , img_cmap = bone , in_place = True , ax = None ) Summary
Show a Region Adjacency Graph on an image.
Extended Summary
Given a labelled image and its corresponding RAG, show the nodes and edges of the RAG on the image with the specified colors. Edges are displayed between the centroid of the 2 adjacent regions in the image.
Parameters
labels: ndarray, shape (M, N)The labelled image.
rag: RAGThe Region Adjacency Graph.
image: ndarray, shape (M, N[, 3])Input image. If
colormapisNone, the image should be in RGB format.border_color: color spec, optionalColor with which the borders between regions are drawn.
edge_width: float, optionalThe thickness with which the RAG edges are drawn.
edge_cmap: :py:class:`matplotlib.colors.Colormap`, optionalAny matplotlib colormap with which the edges are drawn.
img_cmap: :py:class:`matplotlib.colors.Colormap`, optionalAny matplotlib colormap with which the image is draw. If set to
Nonethe image is drawn as it is.in_place: bool, optionalIf set, the RAG is modified in place. For each node
nthe function will set a new attributerag.nodes[n]['centroid'].ax: :py:class:`matplotlib.axes.Axes`, optionalThe axes to draw on. If not specified, new axes are created and drawn on.
Returns
lc: :py:class:`matplotlib.collections.LineCollection`A collection of lines that represent the edges of the graph. It can be passed to the matplotlib.figure.Figure.colorbar function.
Examples
from skimage import data, segmentation, graph import matplotlib.pyplot as plt img = data.coffee() labels = segmentation.slic(img) g = graph.rag_mean_color(img, labels) lc = graph.show_rag(labels, g, img) cbar = plt.colorbar(lc)✓
Aliases
-
skimage.graph.show_rag