Skip to content

Fix component colorbar tick placement in pop_topoplot - #956

Merged
arnodelorme merged 1 commit into
developfrom
codex/topoplot-colorbar-ticks
Sep 8, 2026
Merged

arnodelorme merged 1 commit into
developfrom
codex/topoplot-colorbar-ticks

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Use the axes returned by cbar consistently in pop_topoplot, rather than relying on the current axes. Keep numeric labels for scales that do not cross zero. For signed component scales, calculate the zero tick from the colorbar limits so that all ticks are increasing and zero is placed correctly on asymmetric scales.

No component values or color limits are changed.

Add eleven regression tests and run the core tests folder in the existing MATLAB CI job when a MATLAB license token is available.

Verification

MATLAB R2025b on Apple silicon, based on sccn/eeglab:develop at 5c27fc095bc43216ffccdb027f7c40477edf3e2f.

Before the fix, the new tests produced 5 passes and 6 failures. Afterward, all 11 passed. Coverage includes positive, negative, symmetric, asymmetric, zero endpoint and default limits, multiple maps, a zero component, and an unrelated axes.

All four original DIPFIT cases passed in a fresh, fully initialized EEGLAB session. The original BEM plotting call then passed 20 repetitions interleaved with other axes and color scales. The broader EEGLAB run also passed the original BEM case. Representative numeric and asymmetric signed colorbars were rendered and visually inspected.

A preliminary eeglab nogui run lacked DIPFIT model search paths and failed before plotting. The fresh validation above uses the normal EEGLAB startup that initializes the installed plugin. The original intermittent plotting trigger is not claimed to be fully explained by the synthetic cases alone.

results = runtests('tests/test_pop_topoplot_colorbar.m');
assertSuccess(results);

This is problem 4 of the requested local test repair and is independent of the event selection fix in #955.

Octave smoke testing passed. The MATLAB CI execution steps were skipped because the license token was unavailable. The automated review action failed while fetching an unavailable submodule revision, before reviewing this change. These CI limitations are separate from the local MATLAB results above.

Companion test runner and LIMO work: sccn/eeglab_tests#13 and LIMO-EEG-Toolbox/limo_tools#239.

@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Before/after screen captures

Rendered with MATLAB R2025b (Apple silicon) by calling pop_topoplot on sample_data/eeglab_data_epochs_ica.set after eeglab nogui. Left panels: develop at 5c27fc0 (the PR base). Right panels: this PR at 308ba06. Each panel is a print -dpng of the figure produced by the call shown in the header. The line under each panel states whether the call completed or raised an error.

1. Default component scale ('absmax'), single map: unchanged

default limits, single map

2. Signed asymmetric scale, 'maplimits', [-1 3]: visually unchanged

The 0 tick moves from data value 0 to the value interpolated between the two edge labels (-0.004 instead of 0 on a colorbar axis spanning 4.2 units, about 0.1% of the bar height). Not visible at this resolution.

asymmetric limits

3. Zero at the lower edge, 'maplimits', [0 2]

Before: the - and 0 labels are drawn on top of each other at the bottom of the colorbar. After: numeric labels.

zero lower endpoint

4. One-signed scale, 'maplimits', [1 2], single map

Before: pop_topoplot aborts with Value must be a numeric vector whose values increase. when it sets the tick vector [1.05 0 2.10]. The scalp map surface is left invisible because the function never reaches the final set(allobj, 'visible', 'on'). After: the plot completes with numeric labels.

positive limits, single map

5. Default component scale ('absmax'), four maps: unchanged

default limits, four maps

6. One-signed scale, 'maplimits', [1 2], four maps

Same failure as case 4 on the cbar('vert', ...) path used for multiple maps. The figure title is also missing because the function aborts before textsc.

positive limits, four maps

Regression test file run on both checkouts (R2025b)

Checkout Passed Failed
develop 5c27fc0 with tests/test_pop_topoplot_colorbar.m copied in 5 6 (Positive, Negative, Asymmetric, ZeroLowerEndpoint, ZeroUpperEndpoint, MultiplePositiveMaps)
PR head 308ba06 11 0

The asymmetric case fails on the base only because the test asserts the edge-label interpolation convention introduced by this PR, not because the tick was visibly misplaced (see case 2).

@arnodelorme
arnodelorme merged commit d3d77e7 into develop Sep 8, 2026
2 of 3 checks passed
@arnodelorme
arnodelorme deleted the codex/topoplot-colorbar-ticks branch September 8, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant