title: plotly bar graph - adding percentages to labels
body: <p>I'm trying to create a simple bar chart using the <code>plotly</code> package in R. I want to add labels above each bar, but I've only be able to successfully add in the counts. Is it all possible to add in percentages next to each count? This is what I have:</p>
  
  <pre><code>fig_valve &lt;- plot_ly(valve_df, 
                      x = ~vlvsz_c, 
                      y = ~count,
                      type = "bar",
                      hoverinfo = "x+y")
  fig_valve &lt;- fig_valve %&gt;%
    add_text(text = ~count, 
             textposition = "top", 
             textfont = list(size = 11, color = "black"), 
             showlegend = FALSE) %&gt;%
    layout(title = "",
           xaxis = list(title = "Valve Size", showgrid = FALSE), 
           yaxis = list(title = "Count", showgrid = FALSE),
           showlegend = FALSE,
           font = t)
  </code></pre>
  
  <p>The output: <a href="https://i.stack.imgur.com/iYqZF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iYqZF.png" alt="enter image description here"></a></p>
  
  <p>I'm wondering if I can add in the percentages for each category. Greatly appreciate any suggestions!</p>