You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be nice if we could change the 5 (6 if boxmean=TRUE) hoverinfo texts of Plotly's boxplots to custom values.
#2094 seems to introduce the text attribute for the individual data points in boxplots. An additional boxtext attribute for the aggregate summary statistics (min, lower quartile, median, mean, upper quartile, max) hoverinfo texts would be awesome.
This seems to become even more relevant when other whisker options get intoduced as proposed in #277. To give viewers an idea of what the values of the boxplot actually depict, the boxtext attribute could then be set to an adequately explanatory character vector.
I think you're looking for more box-centric hoverinfo flags, not a new attribute.
For example, hoverinfo: 'x+q1+mean' would only show the x, q1 and mean hover labels.
That would be nice, too – but not what I meant. I want to change the actual text that is displayed in the q1, mean etc. hoverinfo labels. So instead of just displaying the bare number of the mean for example I wanna show something like 10.3 (mean) by setting boxtext to a corresponding character vector (1st string corresponds to min, 2nd to q1, 3rd to median, 4th to q3 and 5th to max if boxmean is false). Then I could set hoverinfo: 'x+y+boxtext'.
Of course I had to calculate the numbers myself if I wanna concatenate them with my custom strings, i.e. include them directly in boxtext but since I'm using R this isn't a big deal, I can just take them from boxplot.stats() from grDevices 😬 (although it would surely be more user-friendly if the values plotly calculated could be directly accessed). In that case I would set hoverinfo: 'x+boxtext'.
Additionally it could make sense to "hardcode" the ordering of the values of boxtext in the case that boxmean is set to true/"sd", so that the hoverinfo text for median always corresponds to the 3rd string and the one for the mean always to the 4th (only relevant if 6 strings are provided in boxtext; without the mean the actual order is always the same by definition).
Ok. I can't say I'm a fan of this proposal. Sure, plugging numbers would be easy from R, but then we can't guarantee the numbers will exactly match the ones on the plot.
Note that PR #2094 also adds text descriptors to the box hover labels:
for the boxplot using plot_ly, Is it possible to have a "text" hoverinfo similar to what we can define for type="bar" ? For example, I just want to show the median, Q1, and Q3 in a text box when I hover over a box with some additional information that I can write in that box. For example, see the figure below:
However, I found no information about the boxplot tooltip customization/replacement (ex : How can I show a multiline text instead of having multiple tooltips? How can I translate 'median' and 'min' keywords ? How can I feed a tooltip with the statistics automatically computed by plotly.js ?)
@nmoreaud
This is something I'm looking for as well. Instead of having multiple tooltips separately for each of the values I need one textbox showing all the values in one place (this is useful when the chart has space boundaries and the values are being cut off). I wonder if this is possible here.
Activity
etpinard commentedon Nov 13, 2017
I think you're looking for more box-centric
hoverinfoflags, not a new attribute.For example,
hoverinfo: 'x+q1+mean'would only show the x, q1 and mean hover labels.salim-b commentedon Nov 13, 2017
That would be nice, too – but not what I meant. I want to change the actual text that is displayed in the
q1,meanetc. hoverinfo labels. So instead of just displaying the bare number of themeanfor example I wanna show something like 10.3 (mean) by settingboxtextto a corresponding character vector (1st string corresponds tomin, 2nd toq1, 3rd tomedian, 4th toq3and 5th tomaxifboxmeanisfalse). Then I could sethoverinfo: 'x+y+boxtext'.Of course I had to calculate the numbers myself if I wanna concatenate them with my custom strings, i.e. include them directly in
boxtextbut since I'm using R this isn't a big deal, I can just take them fromboxplot.stats()fromgrDevices😬 (although it would surely be more user-friendly if the values plotly calculated could be directly accessed). In that case I would sethoverinfo: 'x+boxtext'.Additionally it could make sense to "hardcode" the ordering of the values of
boxtextin the case thatboxmeanis set totrue/"sd", so that the hoverinfo text formedianalways corresponds to the 3rd string and the one for themeanalways to the 4th (only relevant if 6 strings are provided inboxtext; without themeanthe actual order is always the same by definition).etpinard commentedon Nov 13, 2017
Ok. I can't say I'm a fan of this proposal. Sure, plugging numbers would be easy from R, but then we can't guarantee the numbers will exactly match the ones on the plot.
Note that PR #2094 also adds text descriptors to the box hover labels:
salim-b commentedon Nov 13, 2017
Awesome, almost exactly what I meant. Now I wanna just be able to customize those text descriptors, e.g. to translate them into my native language 🙂
etpinard commentedon Nov 13, 2017
Then, this will be part of #856
salim-b commentedon Nov 13, 2017
Allright, that looks promising and would fully enable what I wanna accomplish, I guess 👍
amirh357 commentedon May 1, 2019
for the boxplot using plot_ly, Is it possible to have a "text" hoverinfo similar to what we can define for type="bar" ? For example, I just want to show the median, Q1, and Q3 in a text box when I hover over a box with some additional information that I can write in that box. For example, see the figure below:

nmoreaud commentedon Aug 4, 2020
Hello, here is an example where I add another hover information : (https://codepen.io/kiruahxh/pen/PoNYvWw)
However, I found no information about the boxplot tooltip customization/replacement (ex : How can I show a multiline text instead of having multiple tooltips? How can I translate 'median' and 'min' keywords ? How can I feed a tooltip with the statistics automatically computed by plotly.js ?)
datainvestor commentedon Dec 15, 2020
@nmoreaud
This is something I'm looking for as well. Instead of having multiple tooltips separately for each of the values I need one textbox showing all the values in one place (this is useful when the chart has space boundaries and the values are being cut off). I wonder if this is possible here.