Skip to content

Value displayed in the hover label is incorrect #1518

@felixveysseyre

Description

@felixveysseyre

Hello,

I am working with PlotlyJS to display scientific data.

Some numbers in my traces are displayed using scientific notation. For example -9.57760792915282e-20. Here is an example of such a plot: CodePen.

Unfortunately, PlotlyJS seem to handle small number displaying weirdly:
capture d ecran 2017-03-27 a 11 41 03

As you can see the hover box is displaying -95.77608 in stead of -9.57760792915282e-20.

Thanks

Activity

etpinard

etpinard commented on Mar 29, 2017

@etpinard
Contributor

Thanks for report.

This one is a little weird. Under hovermode: 'closest' the hover labels look fine and then when returning to hovermode: 'x' the comparison hover labels look ok.

peek 2017-03-29 12-35


For devs, http://codepen.io/etpinard/pen/RpqPvP is a little easier to digest.

changed the title [-]Value displayed in the hover box is false[/-] [+]Value displayed in the hover box is incorrect[/+] on Apr 10, 2017
changed the title [-]Value displayed in the hover box is incorrect[/-] [+]Value displayed in the hover label is incorrect[/+] on Jun 9, 2017
claresloggett

claresloggett commented on Aug 18, 2017

@claresloggett

I just thought I'd add a comment to this as I was about to file a separate bug report, then realised that this may be the same issue. In short, my issue was that I was getting the wrong hover label, and the fix was to set hovermode="closest". As a naive user it just looked like a bug to me so I would suggest that maybe hovermode="closest" should be the default setting - it seems to me the intuitive behaviour.

Here's a code snippet that demonstrates what I thought at first was a "bug". I cannot get a tooltip for the B point in this dataset with the default hover mode, because the C tooltip comes up instead:

import pandas as pd
import io

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
init_notebook_mode()

df_str = """\
x y label
1 2 A
2 1 B
2 3 C"""

with io.StringIO(df_str) as f:
    df = pd.read_table(f, sep=" ")

scatter = go.Scatter(x = df['x'], y = df['y'], 
                     mode = 'markers',
                     marker = {'size':10}
                     text = df['label'])

layout = go.Layout(
    xaxis={'range': [0, 3]},
    yaxis={'range': [0, 4]},
)

fig = go.Figure(data=[scatter], layout=layout)
plot(fig)
alexcjohnson

alexcjohnson commented on Mar 7, 2018

@alexcjohnson
Collaborator

This seems to have been fixed some time ago, as of v1.30.0 - perhaps #1932.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @claresloggett@alexcjohnson@felixveysseyre@etpinard

        Issue actions

          Value displayed in the hover label is incorrect · Issue #1518 · plotly/plotly.js