rAmCharts - amPie
Parameters
- data: a dataframe with at least 2 columns: label (character), and value (numeric). See data_pie for example. You can add a third column “color” (character, colors in hexadecimal) to specify the colors.
- show_values: a boolean, TRUE to display values.
- depth: a numeric, between 0 and 100. If superior to 0, chart is displayed in 3D.
- inner_radius: a numeric, between 0 ans 100. If superior to 0, the pie becomes a donut chart.
- …: other parameters called in amOptions.
Data used in the examples:
data("data_pie")
head(data_pie)
## label value
## 1 Facebook 38
## 2 Twitter 25
## 3 LinkedIn 15
## 4 Google+ 14
## 5 Pinterest 8
Reference example
amPie(data = data_pie)
Don’t display values
amPie(data = data_pie, show_values = FALSE)
3D pie
amPie(data = data_pie, depth = 10)
Donut chart
amPie(data = data_pie, inner_radius = 50)
All options
amPie(data = data_pie, inner_radius = 50, depth = 10, show_values = TRUE)
amOptions
legend
amPie(data = data_pie, legend = TRUE)
#or
amPie(data = data_pie) %>>%
amOptions(legend = TRUE)
legendPosition
amPie(data = data_pie, legend = TRUE, legendPosition = "left")
#or
amPie(data = data_pie) %>>%
amOptions(legend = TRUE, legendPosition = "left")
export
amPie(data = data_pie, export = TRUE)
#or
amPie(data = data_pie) %>>%
amOptions(export = TRUE)
exportFormat
amPie(data = data_pie, export = TRUE, exportFormat = "JPG")
#or
amPie(data = data_pie) %>>%
amOptions(export = TRUE, exportFormat = "JPG")
main and creditsPosition
amPie(data = data_pie, main = "My Pie",
mainColor = "#68838B", mainSize = 25, creditsPosition = "bottom-right")
#or
amPie(data = data_pie) %>>%
amOptions( main = "My Pie",
mainColor = "#68838B", mainSize = 25, creditsPosition = "bottom-right")
theme
amPie(data = data_pie, theme = "patterns")
#or
amPie(data = data_pie) %>>%
amOptions(theme = "patterns")