plot_pie: Pie chart in kedata style

View source: R/plot_pie.R

plot_pieR Documentation

Pie chart in kedata style

Description

create pie chart form 2 variabel in kedata style. Percentage computed from each y varaibel value / total of y value * 100

Usage

plot_pie(data, x, y, color, title, subtitle, data_source)

Arguments

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

Value

ggplot and ggarrange object

Examples

## 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)

eppofahmi/dataplot documentation built on Jan. 22, 2025, 1:14 a.m.