mne-tools / mne-tools/mne-python

ENH: Improve representation of epochs time bar

Open
#10,854 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

There are two separable issues here:

  1. what duration should the bar represent?
  2. should the number be displayed in seconds or milliseconds?

For point 1, I don't necessarily think it should be shorter (or longer). I think it should be a nice round number. Think about scale bars on maps, etc. They tell you how long 1 km is in the map scale; they don't tell you "half the map width corresponds to 252.47 km."

For point 2, I think given the time scales that most people deal with when epoching, displaying in ms makes sense; e.g., 50 ms seems nicer than 0.05 s. We can also make it responsive, so that if someone has 8-second-long epochs, the label can say e.g., 5 s, but if the epoch is shorter than 1s then it displays the length in ms.

As far as aesthetics goes, you're probably right that it will look best if the scalebar is somewhere between, I dunno, 1/4 to 1/2 the width of the epoch on the plot (I just ballparked that without actually playing around with it, use whatever limits are actually aesthetically nice). Once you've decided what those limits are, you can tweak the bar_sizes candidates in my example snippet to make sure we end up with one in that range.

If you're sick of tweaking this, then what you have so far looks pretty nice and is not broken in any way (at least not that I've detected) so I'm OK to merge this and treat points 1 and 2 above as refinements to be done in future PRs (by you or someone else). Of course if I've convinced you, you're free to do them in this PR too. WDYT?

Originally posted by @drammock in https://github.com/mne-tools/mne-python/pull/10736#discussion_r906357120

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked discussion in pull request #10736 to understand the existing epoch time-bar implementation and prior decisions. Define a rounded, aesthetically appropriate bar length and responsive seconds-versus-milliseconds labeling; done means the bar is visually suitable across epoch durations and the behavior is covered by the project's relevant visualization tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.