Description
This function allows you to create cool circular packing charts easily by providing justthe data and a template among the available ones. Moreover, you can choose whether andwhere to display percentages and also optionally specify a title for the chart.
Usage
bubble_blow(data, template, perc = "no", title = "")
Arguments
data | A data frame (or a tibble) with two variables (columns):
|
template | The chosen template. |
perc | You can choose among:
|
title | A string. If you want, you can specify the title of the graph. |
Value
A ggplot object.In particular, this function returns a circular packing chart according to thedata, the choice of the template, and the other specifications provided.
See Also
See all the available templates displayedhere!
Examples
example <- data.frame( c("This", "Is", "Just", "An", "Example"), c(2.9, 6.9, 4.20, 13.12, 6.66))bubble_blow( data = example, template = "bub1", perc = "below", title = "Example1")example2 <- tibble::tibble( c("cat 1", "cat2", "cat3", "cat4", "cat5", "cat6", "cat7", "cat8", "cat9"), c(324, 432, 499, 291, 750, 836, 314, 133, 372))bubble_blow( data = example2, template = "bub2", perc = "right", title = "Ex2")
Description
This function allows to easily add some figures to you pie chart, taking informationfrom the output of the pie_bake
function.You can also customize the chart by specifying the colors of borders and labels, thetitle of the pie chart and where (and if) you want to print the percentagesfor each group.
Usage
pie_addimages( mypie, imglist, perc = "no", lbl_col = "black", border_col = "black", title = "")
Arguments
mypie | A ggplot object. The output from |
imglist | A list of objects returned by and |
perc | You can choose among:
|
lbl_col | A string containing the chosen color for the labels, default is |
border_col | A string containing the chosen color for the border of the piechart, default is |
title | A string. If you want, you can specify the title of the graph. |
Value
A ggplot object.
See Also
Please note that this function is based on the imagepie
function.
Examples
img5 <- jpeg::readJPEG(system.file("img", "pie.jpeg", package = "tastypie"))imgs2 <- list(img5, img5, img5)df2 <- data.frame( c("A", "B", "C"), c(300, 250, 600))mypie2 <- pie_bake(df2, template = "rainbow1")pie_addimages( mypie = mypie2, imglist = imgs2, perc = "right", lbl_col = "darkcyan", border_col = "orangered", title = "Example")
Description
This function allows you to create cool pie charts easily by providing justthe data and a template among the available ones. Moreover, you can choose whetherto display percentages or not and also optionally specify a title for the chartand a name for the categories.
Using this function you can create the classical pie charts (including the donut charts).If you are looking for something more complex and extravagant (but probably lessunderstandable), check out the pie_bake_pro
function.
Usage
pie_bake(data, template, perc = FALSE, group_name = "group", title = "")
Arguments
data | A data frame (or a tibble) with two variables (columns):
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 orletters before the category names (e.g. "a. category1", "b. category2", ...). |
template | The chosen template. |
perc | A logical value. Should the proportions be displayed? |
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. |
Value
A ggplot object.In particular, this function returns a pie (or donut) chart according to thedata, the choice of template, and the other specifications provided.
See Also
See all the available templates displayedhere!
Examples
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( data = example, template = "basic3", perc = TRUE, group_name = "groups", title = "Example1")pie_bake( data = example, template = "red1", title = "Ex2")pie_bake( data = example, template = "donut2", perc = TRUE, group_name = "CAT:")
Description
This function allows you to create cool pie charts easily by providing justthe data and a template among the available ones. Moreover, you can optionallyspecify 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 = "")
Arguments
data | A data frame (or a tibble) with two variables (columns):
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 orletters before the category names (e.g. "a. category1", "b. category2", ...). |
template | The chosen template. |
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. |
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 thedata, the choice of template, and the other specifications provided.
See Also
See all the available templates displayedhere!
Examples
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" )
Description
pie_datacheck
checks if the provided data are suitable for creating pie chartsusing the useful functions in the tastypie
package.
Usage
pie_datacheck(data, check = FALSE)
Arguments
data | The data that you want to use for creating pie charts. |
check | Logical, set equal to TRUE if you need a message to know if there areno problems. |
Value
If the provided data are a dataframe with only two variables (columns) withthe vector of labels in the first one and the vector of values in the second one, nothingwill happen. Otherwise, an error that tells you what's wrong occurs.
Examples
wrong <- c(1, 2, 3)# Would return an Errorwrong2 <- data.frame("a" = c(1, 2, 3), "b" = c("ex", "am", "ple"))# Would return an Errorright <- data.frame("a" = c("ex", "am", "ple"), "b" = c(1, 2, 3))pie_datacheck(right) # No Error ==> OK!pie_datacheck(right, check = TRUE) # Positive message
Description
This function allows to user to find out a random combination of templates,number of groups and features in order to get an idea of the many availableplots in the package tastypie
.
Usage
pie_discover(which = c("all", "bake", "pro"))
Arguments
which | Allows to select a subset of the available templates. If The default value is |
Value
A ggplot object.In particular, this function returns a pie (or similar) chart according to a randomchoice of template and the other features.
See Also
See all the available templates displayedhere!
Examples
pie_discover()pie_discover("pro")
Description
The vector containing all the available templates for pie charts for thepie_bake
function.Other more complex templates are available in pie_template_list_pro
that can be used through the pie_bake_pro
function.
Usage
pie_template_list
Format
An object of class character
of length 30.
See Also
See all the available templates displayedhere!
Description
The vector containing all the available templates for pie charts for thepie_bake_pro
function.Other less complex templates are available in pie_template_list
that can be used through the pie_bake
function.
Usage
pie_template_list_pro
Format
An object of class character
of length 30.
See Also
See all the available templates displayedhere!
Description
This function allows to user to display a pie chart by selecting the template,the number of groups of interest and whether to display the proportions or not,in order to make it easier to choose between the many templates available in thepackage tastypie
.
Usage
pie_templates(template, n_groups = 4, perc = FALSE)
Arguments
template | The chosen template. |
n_groups | A number from 2 to 9. |
perc | A logical value. Should the proportions be displayed? |
Value
A ggplot object.In particular, this function returns a pie (or similar) chart according to thechoice of template and the other specifications provided.
See Also
See all the available templates displayedhere!
Examples
pie_templates(template = "bw1", n_groups = 3, perc = TRUE)pie_templates(template = "watermelon2", n_groups = 8)
Description
You only need to typewhy pie charts are badon Google to find thousands of articles full of (valid) reasons why other types of chartsshould be preferred over this one.
Therefore, because of the little use due to the reasons already mentioned,making pie charts (and related) in R is not straightforward, so other functions are neededto simplify things.
In this R package there are useful functions to make tasty pie charts immediatelyby exploiting the many cool templates provided.
Author(s)
Author and Maintainer: Paolo Dalena [emailprotected]
See Also
Find more information on the package web sitehere, or on the GitHub package pagehere.