0
votes

I'm having troubles while plotting multiline tooltips in R Plotly (R package version: 4.7.1). The tooltip is not formatted correctly. Text goes outside the tooltip background.

Minimal example:

Plotly tooltip text outside the box

This can be replicated by running the following code:

data <- matrix(c(1:16), ncol = 2)
# Plot the chart
plot_ly(
    x = c("a", "b"),
    y = c(letters[1:8]),
    z = data,
    showscale = FALSE,
    hoverinfo = 'text',
    text = matrix(rep("Lorem ipsum dolor sit amet,<br>consectetur adipiscing elit,<br>sed do eiusmod tempor<br>incididunt ut labore et dolore<br>magna aliqua.<br>Ut enim ad minim veniam, quis<br>nostrud exercitation ullamco laboris nisi<br>ut aliquip ex ea commodo consequat.<br>Duis aute irure dolor in<br>reprehenderit in voluptate velit esse<br>cillum dolore eu fugiat nulla pariatur.", 16), ncol = 2),
    type = "heatmap"
)

This effect is only achievable if you resize the browser window. In my real case I have it in a Shiny app so the space is limited. However, it seems that there is enough space to plot tooltip correctly. Any ideas how to fix this?

1
I am using plotly_4.7.1.9000 I can't reproduce your error. - MLavoie
Hi. I am using plotly_4.8.0 and cannot reproduce your error. - Marco Sandri

1 Answers

0
votes

Updating plotly to 4.8 indeed solves the problem.