title: How to set different text and hoverinfo text
body: <p>I am working with the plotly package, and I cannot find a way to display different things on the chart itself and in the hoverinfo.
  Here is an example of a barchart:</p>
  <pre><code>library(plotly)
  library(dplyr)
  
  data(iris)
  
  df &lt;- iris %&gt;%
    group_by(Species) %&gt;%
    summarise(n = n(),
              avg = mean(Sepal.Length))
  
  p1 &lt;- plot_ly(data = df,
               x = ~Species,
               y = ~n,
               type = &quot;bar&quot;,
               text = ~paste(&quot;Species :&quot;, Species,
                             &quot;&lt;br&gt; Avg :&quot;, avg),
               textposition = &quot;auto&quot;,
               hoverinfo = &quot;text&quot;)
  </code></pre>
  <p>From this code I get this:
  <a href="https://i.stack.imgur.com/kKAn7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kKAn7.png" alt="enter image description here" /></a>
  And I would like to display the frequency (n) value in each bar instead of the same thing as the hoverinfo.</p>
  <p>I have been looking at <a href="https://stackoverflow.com/questions/42170476/custom-hoverinfo-text-on-plotly-r-chart-that-is-different-to-the-text-paramete">this thread</a> but the solution described is too complicated for me and I think there must be an easier way to solve this issue.</p>