imagepie: Plot a pie chart with slices filled with png and jpeg images.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/imagepie.R

Description

The imagepie function is a tool for creating versatile pie charts by filling the slices with external png and jpeg images.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 readPNG and readJPEG used to fill slices.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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')

patternplot documentation built on April 21, 2020, 5:05 p.m.