imagepie {patternplot} | R Documentation |
Plot a pie chart with slices filled with png and jpeg images.
Description
The imagepie
function is a tool for creating versatile pie charts
by filling the slices with external png and jpeg images.
Usage
imagepie(
group,
pct,
label,
label.size = 4,
label.color = "black",
label.distance = 1.35,
pattern.type,
frame.color = "black",
frame.size = 1
)
Arguments
group |
a vector of strings, containing the names of each slice. |
pct |
a vector of non-negative numbers, containing percentages of each group. The numbers must sum up to 100. |
label |
a vector of strings, giving the names for the slices shown in the pie chart. |
label.size |
the font size of labels shown in the pie chart. |
label.color |
the color of labels shown in the pie chart. |
label.distance |
the distance of labels from the border of the pie chart. |
pattern.type |
a list of objects returned by |
frame.color |
the color for the borders of slices. |
frame.size |
a numeric value, the line size for the borders of slices. |
Details
imagepie
function offers flexible ways of doing pie charts.
Value
A ggplot object.
Author(s)
Chunqiao Luo (chunqiaoluo@gmail.com)
See Also
Function patternpie
Examples
library(patternplot)
library(jpeg)
library(ggplot2)
Tomatoes <- readJPEG(system.file("img", "tomatoes.jpg", package="patternplot"))
Peas <- readJPEG(system.file("img", "peas.jpg", package="patternplot"))
Potatoes <- readJPEG(system.file("img", "potatoes.jpg", package="patternplot"))
#Example 1
data <- read.csv(system.file("extdata", "vegetables.csv", package="patternplot"))
pattern.type<-list(Tomatoes,Peas,Potatoes)
imagepie(group=data$group,pct=data$pct,label=data$label,pattern.type=pattern.type,
label.distance=1.25,frame.color='burlywood4', frame.size=0.8, label.size=6,
label.color='forestgreen')