Skip to content

Value displayed in the hover label is incorrect #1518

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

Closed
felixveysseyre opened this issue Mar 27, 2017 · 3 comments
Closed

Value displayed in the hover label is incorrect #1518

felixveysseyre opened this issue Mar 27, 2017 · 3 comments
Labels
bug something broken

Comments

@felixveysseyre
Copy link

felixveysseyre commented Mar 27, 2017

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

@etpinard
Copy link
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.

@etpinard etpinard added the bug something broken label Mar 29, 2017
@etpinard etpinard changed the title Value displayed in the hover box is false Value displayed in the hover box is incorrect Apr 10, 2017
@etpinard etpinard changed the title Value displayed in the hover box is incorrect Value displayed in the hover label is incorrect Jun 9, 2017
@claresloggett
Copy link

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
Copy link
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
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

4 participants