I am trying to plot some air pollutants data using R Plotly
package. So far, I am able to achieve this.
library(plotly)
val <- c(10, 12,4, 16, 8)
ap <- c("NO2", "PM10", "PM2.5", "NOx", "SO2")
plot_ly(labels = ~ap, values = ~val, type = 'pie',
textposition = 'inside',
textinfo = 'label')
I would like to improve this pie-chart. I want to show '10
' in PM10
as subscript and write "custom text" next to label. My expected outcome: PM[10] (47%)
and so on. Someone care to explain how to achieve this?