Learn R Programming

tastypie (version 0.1.1)

pie_bake_pro: Easily create (more complex) pie charts

Description

This function allows you to create cool pie charts easily by providing just the data and a template among the available ones. Moreover, you can optionally specify a title for the chart and a name for the categories.

Using this function you can create some complex and extravagant pie charts. If you are looking for something more classical (and probably more understandable), check out the pie_bake function.

Usage

pie_bake_pro(data, template, group_name = "group", title = "")

Value

A ggplot object (or no value if the chosen template is among the spider chart ones). In particular, this function returns a pie (or similar) chart according to the data, the choice of template, and the other specifications provided.

Arguments

data

A data frame (or a tibble) with two variables (columns):

  • in the first one there must be the vector of labels;

  • in the second one there must be the vector of values.

Please note that the labels are automatically sorted in alphabetical order. If you want to specify a particular order, it is recommended to type numbers or letters before the category names (e.g. "a. category1", "b. category2", ...).
You can use pie_datacheck to understand if the data is suitable.

template

The chosen template.
Type pie_template_list_pro to display all the available ones for this function.

group_name

A string. If you want, you can specify a name for the categories.

title

A string. If you want, you can specify the title of the graph.

See Also

See all the available templates displayed here!

Examples

Run this code
example <- data.frame(
  c("a. This", "b. Is", "c. Just", "d. An", "e. Example"),
  c(2.9, 6.9, 4.20, 13.12, 6.66)
)
pie_bake_pro(
  data = example,
  template = "eaten3",
  group_name = "cat:",
  title = "Example1"
)

pie_bake_pro(
  data = example,
  template = "dart1",
  title = "Example2!"
)

pie_bake_pro(
  data = example,
  template = "eye5",
  group_name = "GROUPS:"
)

pie_bake_pro(
  data = example,
  template = "spider2"
  )


Run the code above in your browser using DataLab