When working with complex molecular systems, clarity is everything. Whether you’re preparing a presentation or trying to make sense of a large model, the ability to control what is shown—and what is hidden—can make a huge difference. Labels are an essential part of annotating molecular models, but in dense scenes, they can quickly create visual clutter.
Fortunately, the Node Specification Language (NSL) in SAMSON provides molecular modelers with a precise way to filter, hide, and show labels thanks to the label attribute space (la for short). In this post, we’ll focus on how to control **label visibility** using these attributes, helping you keep your visualizations neat and purposeful.
Why Controlling Label Visibility Matters
You’ve probably encountered a situation where every atom, bond, or structure in your model is annotated, and suddenly your screen becomes unreadable. Or maybe you’ve manually turned labels off one by one, wasting time better spent analyzing your data.
Label nodes in SAMSON can be filtered using the NSL to instantly target groups of labels based on their visibility state—without manual clicking. That’s especially powerful when you work with many labels or want to automate your visualization workflow.
The Visibility Attributes at a Glance
Here’s a breakdown of attributes available in the la (label) space related to visibility control:
| Attribute | Short name | Description | Example |
|---|---|---|---|
visible |
v |
True if the label is currently visible | la.v (visible labels), not la.v (hidden labels) |
visibilityFlag |
vf |
Specifies whether label’s visibility can be toggled | la.vf false |
hidden |
h |
Labels that are hidden from view | la.h, not la.h |
Each of these can be combined to express queries that help you quickly find and tweak labels, such as:
|
1 2 3 4 |
la.v</code> - All visible labels not la.v</code> - All invisible labels la.h</code> - All explicitly hidden labels la.vf false</code> - Labels set to not allow visibility toggling |
When to Use Them
- Preparing publication-quality screenshots: Hide unnecessary labels to emphasize what matters.
- Collaborating remotely: Make your explanations clearer by controlling what your colleagues see.
- Scripting workflows: Batch-update visibility without manually clicking each label on screen.
These visibility attributes are inherited from label nodes’ parent attributes but are specifically tuned for managing label nodes. The short names (v, vf, h) make filtering fast and scriptable.
A Quick Tip
Combine visibility attributes with name matching using la.n for even more control. For instance:
|
1 |
la.n "A*" and not la.v |
This finds all labels starting with “A” that are not currently visible.
By learning how to filter label nodes using the visibility attributes built into SAMSON’s NSL, you’ll spend less time cleaning up scenes and more time getting insights out of your models.
To learn more, check out the full documentation: https://documentation.samson-connect.net/users/latest/nsl/label/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
