Reputation: 127
I have to use ggplotly for my boxplot, but it only displays 2 decimal places. So a lot of my values will show 0.00 in the plot. As you can see in the example from plotly's website https://plot.ly/ggplot2/box-plots/ , only display 2 decimal. If I use plot_ly, I can see all the decimal places as in the example https://plot.ly/r/box-plots/#version-check. Is there anyway to display all decimal in ggplotly ? Thank you.
Upvotes: 1
Views: 1159
Reputation: 50718
This should've been fixed in issue #834; according to the changes:
ggplotly()
now appliesformat()
to automatically generated hoverinfo. This will allow for finer control over the text displayed (for instance,options(digits = 4)
can now be used to choose the number of significant digits used). See #834 for an example.
However, options(digits = 4)
does not have any effect on the number of decimal places in a boxplot's hoverinfo; numbers are still rounded to 2 digits.
Reproducible minimal example:
require(ggplot2);
require(plotly);
# Sample data
set.seed(2017);
df <- cbind.data.frame(one = rnorm(100), two = rnorm(100, mean = 4));
# Plot
options(digits = 4);
ggplotly(
ggplot(stack(df), aes(ind, values)) + geom_boxplot(aes(fill = ind)));
You should probably (re-open)open (the)an issue on github.
Upvotes: 1