Skip to content

Hover text showing only first letter #1125

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
tuomastik opened this issue Sep 22, 2017 · 10 comments
Closed

Hover text showing only first letter #1125

tuomastik opened this issue Sep 22, 2017 · 10 comments

Comments

@tuomastik
Copy link

Hover tooltip shows only first letter when color and colors parameters are provided. Without color and colors parameters, the text is shown correctly.

library(plotly)

plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,
        color = as.factor(rownames(mtcars)),
        colors = grDevices::heat.colors(nrow(mtcars)),
        hoverinfo = "text",
        text = rownames(mtcars)) %>% add_markers()

The code above produces the following figure:
image

The following figure is produced without color and colors parameters:
image

@tuomastik
Copy link
Author

Managed to solve the issue by wrapping the value of text parameter into a list().

@drowsygoat
Copy link

Hi Tuomastik, did you have any other insight into this problem? I have exactly the same problem, but listing the attributes only made it worse.

@tuomastik
Copy link
Author

@drowsygoat Unfortunately no. I can only suggest comparing your implementation to the code snippet (and its solution) provided in my first comment.

@ghost
Copy link

ghost commented Dec 12, 2017

I have run into the same problem. Instead of my custom hover text some points show "<" instead of the message. Putting the code inside a list() results in correct hover texts for the points that showed "<" before, but NO hover text for all other points.
This is how I code it
hoverinfo = 'text' ,
text = ~paste ('
', 'Cluster ID: ', Idf[[paste('sub.flow.', groupID, sep = '')]],
'
', 'Particle ID:', Idf[['newid' ]],
'
', paste(input[[paste('x_axis', plotID, sep = '')]],': ', sep =''), format(round(Idf[[input[[paste('x_axis', plotID, sep = '')]] ]], digits=2), nsmall =2),
'
', paste(input[[paste('y_axis', plotID, sep = '')]],': ', sep =''), format(round(Idf[[input[[paste('y_axis', plotID, sep = '')]] ]], digits=2), nsmall =2),
'
', paste(input[[paste('z_axis', plotID, sep = '')]],': ', sep =''), format(round(Idf[[input[[paste('z_axis', plotID, sep = '')]] ]], digits=2), nsmall =2)),

image

@ghost
Copy link

ghost commented Dec 15, 2017

Additional info on this bug: If I run the plot on my full 100.000 data set, NO PROBLEM, as soon as I do any form of subsetting, varying from dfx[1:1000, ], dfx[listofrandomrownumbers, ] or grabbing 10% per category in a for loop, or running a dplyr arrange solution to subset, they all result in the same bug.

I also noticed that if i just plot 1 point, and it has the buggy hover, that rotating the camera view fixes it,
but if there are multiple points, this trick does nothing for the issue.

@MartinsRodrigo
Copy link

Same issue here, but the list() solution doesnt work

@cpsievert
Copy link
Collaborator

I believe I() (instead of list()) would be a more general work-around:

plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,
        color = as.factor(rownames(mtcars)),
        colors = grDevices::heat.colors(nrow(mtcars)),
        hoverinfo = "text",
        text = I(rownames(mtcars))) %>% add_markers()

@cpsievert
Copy link
Collaborator

A proper fix for this will likely have to come from plotly.js -- I've started an issue here -- plotly/plotly.js#2693

@abautistah
Copy link

list worked for me, =D

hoverinfo = "text", text = list(size_cluster$sizesc)

@cpsievert
Copy link
Collaborator

This issue appears to be fixed now.

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

No branches or pull requests

5 participants