Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event names getting overlapped It #11495

Open
Dev-satish opened this issue Feb 20, 2023 · 9 comments
Open

Event names getting overlapped It #11495

Dev-satish opened this issue Feb 20, 2023 · 9 comments
Labels

Comments

@Dev-satish
Copy link

Description of the problem

While I was trying to reproduce the issue in #130 in mne-tools/mne-qt-browser I saw that the event name are getting overlapped with each other

Steps to reproduce

# %%
import mne

sample_dir = mne.datasets.sample.data_path()
sample_fname = sample_dir / 'MEG' / 'sample' / 'sample_audvis_raw.fif'

raw = mne.io.read_raw_fif(sample_fname)
raw.crop(tmax=60)

events = mne.find_events(raw, stim_channel='STI 014')
event_id = {'auditory/left': 1, 'auditory/right': 2, 'visual/left': 3,
            'visual/right': 4, 'face': 5, 'buttonpress': 32}


raw.plot(events=events, event_id=event_id)

Link to data

No response

Expected results

It should have been consistent with the event duration like shown by @hoechenberger in the issue

image

Actual results

issue

Additional information

none

@Dev-satish Dev-satish added the BUG label Feb 20, 2023
@Dev-satish
Copy link
Author

I realized that as soon as I press - time button it the event name separates but I feel this issues can still be worked upon
image

@hoechenberger
Copy link
Member

Yes it's definitely an issue; I wonder if we could detect the collision and display just a marker or truncated event description in that case, and only expose the full description on hover.

@Dev-satish
Copy link
Author

What if we add a header and display the description there.
I think I could explain it better visually-
s1
s2

@cbrnr
Copy link
Contributor

cbrnr commented Feb 20, 2023

You will always be able to have long enough event names to overflow even in a dedicated area.

@cbrnr
Copy link
Contributor

cbrnr commented Feb 20, 2023

Yes it's definitely an issue; I wonder if we could detect the collision and display just a marker or truncated event description in that case, and only expose the full description on hover.

If this is possible I think a truncated version would be very nice! I'd truncate first, and if even that doesn't work (e.g. zoom out far enough) I'd remove the label completely.

Color-coding event types would be a good idea not just in that particular case – is this supported?

@hoechenberger
Copy link
Member

hoechenberger commented Feb 20, 2023

I'd like to second @cbrnr's proposals, I like that

@marsipu
Copy link
Member

marsipu commented Feb 20, 2023

Color-coding event types would be a good idea not just in that particular case – is this supported?

You can pass a dict with custom colors to event_color in raw.plot(). Or do you mean something else?

@marsipu
Copy link
Member

marsipu commented Feb 20, 2023

A qt-favoring solution in terms of simplicity might also be giving the event-labels a background with the color of the plot-background. If they stack you could at least read the one on top. And to expand we could intercept hoverEvent of EventLine to put the hovered EventLine on top (self.setZValue(1)).
You find the code for the InfiniteLine from pyqtgraph which EventLine inherits here.

@cbrnr
Copy link
Contributor

cbrnr commented Feb 21, 2023

You can pass a dict with custom colors to event_color in raw.plot(). Or do you mean something else?

Yes, but I meant the default behavior should be different colors for different events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants