mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

ENH: Improve representation of epochs time bar

Open larsoner opened this issue 3 years ago • 1 comments

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

larsoner avatar Jun 28 '22 13:06 larsoner

BTW my vote would be to display anything < 1 s using x ms and >= 1 s using x s, I think it'll be easier for people to read 50 ms than 0.05 s

larsoner avatar Jun 28 '22 13:06 larsoner