plot_pie | R Documentation |
create pie chart form 2 variabel in kedata style. Percentage computed from each y varaibel value / total of y value * 100
plot_pie(data, x, y, color, title, subtitle, data_source)
data |
data frame with 2 variabel representing categorical and numeric data |
x |
categorical variabel |
y |
numeric variabel |
color |
character of color hexagon for coloring x variabel |
title |
character |
subtitle |
character |
data_source |
character |
ggplot and ggarrange object
## Not run:
library(dataplot)
library(ggplot2)
df <- data.frame(
"brand" = c("Samsung", "Huawei", "Apple", "Xiaomi", "OPPO"),
"share" = c(10, 30, 20, 35, 5)
)
mycolor <- c("#55DDE0", "#33658A", "#2F4858", "#F6AE2D", "#F26419")
plot_pie(
data = df, x = "brand", y = "share", color = mycolor,
title = "Lorem Ipsum is simply dummy text",
subtitle = "Contrary to popular belief, Lorem Ipsum is not simply random text",
data_source = "Sumber: www.kedata.online"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.