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

Plotting spectra with annotations has hiccups #178

Open
fu opened this issue Sep 7, 2019 · 0 comments
Open

Plotting spectra with annotations has hiccups #178

fu opened this issue Sep 7, 2019 · 0 comments
Assignees
Labels
Improvement extend functionality modification Small modification to clear-up an issue

Comments

@fu
Copy link
Member

fu commented Sep 7, 2019

Describe the bug
After plotting a spectrum with multiple annotations and deselecting some of annotations in random order will give funny results. Might have to do with the way we are currently plotting data.

Solution
Instead of duplicating each data point three times (1. normal data point (mz/i), 2. zero I data point (mz, 0) and 3. line breaking point (mz+x, None) ) we could "misuse" the error bars.

This example will produce the wanted "stick" representation with only one data point and stops plotly to be confused about annotations:

        go.Scatter(
            x=ldf['mz'],
            y=ldf['Intensity'],
            name='{0}@{score}: {seq#mod}'.format(k, **v),
            mode="markers+text",
            marker={
                'size': 1,
            },
            marker_color=color_set[pos][0],
            line = {
                'color': color_set[pos][0],
                'width': 0.5
            },
            error_y={
                'type': 'data',
                'symmetric': False,
                'arrayminus': ldf['Intensity'],
                'visible': True,
                'thickness': 1,
                'width': 1
            },
            text=ldf['{0}_annotation'.format(k)],
            textfont = {
                'color': color_set[pos][0],
            },
        )
@MKoesters MKoesters self-assigned this Sep 7, 2019
@MKoesters MKoesters added Improvement extend functionality modification Small modification to clear-up an issue labels Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement extend functionality modification Small modification to clear-up an issue
Projects
None yet
Development

No branches or pull requests

2 participants