Reputation: 666
I'm looking for a way to increase the 'precision' of the default 2 decimals after the point of a plotly
hover text info in a widget created in R
.
I've searched a lot, but seem not to be able to find a method which does not require me to manually define the hover text. Maybe I'm missing something in the layout()
function...
Some background info which may result in a workaround: I'm trying to display percentage information as a decimal number, but need to be more precise than just 0.01 (=1%). The problem is that the hover text displays the same value 0.01 for e.g. 0.008 and 0.012 which on the graph is obviously not the same.
Any help would be much appreciated!
Upvotes: 4
Views: 2645
Reputation: 9876
You did not provide a reproducible example so here is an example using the iris dataset:
library(plotly)
iris[1, 1] <- 10.678
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, marker =list(hoverformat ="%{4}f"))
Additional ressources for formatting: https://github.com/d3/d3-format/blob/master/README.md#locale_format
Upvotes: 5