How Glue's Brushing-and-Linking Approach Works Across Datasets

Updated

Glue is a Python library for exploring relationships within and among related datasets, and its core interaction model is brushing and linking: a selection you make in one plot (brushing) is automatically propagated to every other plot (linking). This works both within a single dataset and across multiple datasets, provided you define the logical links between them. If your task involves comparing the same objects across several tables or files, this model is designed for exactly that; if you only need one static chart, it adds little.

The two mechanisms

Brushing

Brushing is the act of selecting a subset of data points in a visualization. Glue supports scatter plots, histograms, and images (2D and 3D). When you brush a region in one of these views, you are marking a subset of rows as "selected."

Linking

Linking is what happens next: that selection propagates to all other open visualizations. Any other plot showing the same data highlights the same subset, so you can see where those points fall in a different projection, distribution, or image.

How linking works across datasets

Within one dataset, linking is straightforward — all views share the same rows. Across datasets, Glue relies on the logical links that exist between them. These links are:

  • Specified by the user — Glue does not guess them for you.
  • Arbitrarily flexible — a link can connect datasets on any shared column or key, not just an identical index.

Once a link is defined, Glue uses it for two purposes: overlaying visualizations of different data on top of each other, and propagating selections from one dataset to the other. So if you brush a set of objects in dataset A, the corresponding rows in dataset B are selected too.

A concrete example: suppose you have one table of galaxy observations and a second table of follow-up measurements, joined by a common object ID. After linking the two on that ID, brushing a cluster in a scatter plot of the first table highlights the matching follow-up rows in the second — without writing any join code.

Where this fits in your workflow

Glue is built for "data-hacking" workflows and blurs the boundary between GUI-centric and code-centric exploration. You can:

  • Use the graphical application as-is and never type a line of code.
  • Interact via Python — through the IPython terminal built into the application, or by sending NumPy arrays or Pandas DataFrames to Glue from a Python or IPython session.
  • Customize the setup with config.py files, for example to auto-load and clean data before Glue starts, parse a custom file format, define custom linking functions, or create your own data viewers.

Because Glue is written in Python on top of NumPy, Matplotlib, and SciPy, you can integrate your own code for data input, cleaning, and analysis alongside the interactive views.

Is it the right tool for you?

Your task Brushing-and-linking fit
Compare the same objects across multiple tables/files Strong — this is the intended use case
Explore distributions and correlations interactively Strong — selections propagate across all views
Produce a single static figure Weak — a plotting library alone is simpler
Automate a fixed analysis pipeline Weak — the value is in interactive selection

If your exploration is genuinely interactive and spans related datasets, the brushing-and-linking model is the reason to use Glue. If not, the linking machinery is overhead you won't use.