I have this sample data frame :
> Data
Produits Pourcentages
1 Crème de jour 27.10
2 sérum 14.50
3 Crème de nuit 13.80
4 masque 8.82
5 démaquillant à rincer 7.73
6 démaquillant sans rincage 7.24
7 lotion 6.57
8 eau florale 5.83
9 huile 5.65
10 produits teintés 2.82
Then, I want to plot a pie chart using only the plotly
package.
library(dplyr)
library(plotly)
p <- plot_ly(Data, labels = ~Produits, values = ~Pourcentages, type = 'pie') %>%
layout(title = 'United States Personal Expenditures by Categories in 1960',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
It gives me this pie chart:
But I don't need to get many colors, I just need one scaled color which has an intensity that increases in function of the variable Pourcentages
.
In another word, I want a pie chart using plotly
package like this:
Thank you for your help !