Skip to main content
100%

Small function to add a coordinate system indicator without visible axes to a umap-plot

✓ Published0🌍 Public
MMNoichl
Last edited Apr 30, 2024
Created on Apr 30, 2024

This example shows how to add a compact UMAP-X and UMAP-Y coordinate indicator to an existing Matplotlib plot, providing spatial orientation without visible axes. The code defines a function that uses `fig.add_axes` to create a transparent inset axis with an equal aspect ratio, then draws the coordinate lines via `ax_inset.plot` and `ax_inset.vlines`, with bold labels added through `ax_inset.text` for each axis. The inset is positioned relative to the base axes using figure-space coordinates, and the line length is scaled by a ratio parameter. The example demonstrates a reusable Matplotlib technique for overlaying minimal directional cues on dimensionality-reduction scatter plots from any source.

AI-generated description

Similar vizzes