File: fan.plot.Rd

package info (click to toggle)
r-cran-plotrix 3.2-6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,136 kB
  • sloc: makefile: 3
file content (80 lines) | stat: -rwxr-xr-x 3,848 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
\name{fan.plot}
\alias{fan.plot}
\title{ Display a fan plot }
\description{
 Displays numerical values as the arcs of overlapping sectors.
}
\usage{
 fan.plot(x,edges=200,radius=1,col=NULL,align.at=NULL,max.span=NULL,
  labels=NULL,labelpos=NULL,label.radius=1.2,align="left",shrink=0.02,
  main="",ticks=NULL,include.sumx=FALSE,...)
}
\arguments{
 \item{x}{Vector of numbers.}
 \item{edges}{The number of edges with which to draw a circle.}
 \item{radius}{The radius of the sectors.}
 \item{col}{The colors with which to fill the sectors.}
 \item{align.at}{Where to align the sectors (see Details).}
 \item{max.span}{The angle of the maximal sector in radians. The default
  is to scale \samp{x} so that it sums to 2*pi.}
 \item{labels}{Labels placed around the sector arcs.}
 \item{labelpos}{Optional circumferential positions for the labels.}
 \item{label.radius}{How far away from the sectors the labels will
  be placed. May be a vector with a radius for each label.}
 \item{align}{Position of the alignment of sectors (see Details).}
 \item{shrink}{How much to shrink each successive sector in user units.}
 \item{main}{Optional title for the plot.}
 \item{ticks}{The number of ticks that would appear if the sectors were on
  a pie chart. Default is no ticks, TRUE gives the number of ticks equal to
  the integer sum of \samp{x}, which is fairly sensible if 
  \samp{x} is a vector of integers.}
 \item{include.sumx}{Whether to include the sum of all \samp{x} values
  as the largest sector.}
 \item{...}{Additional arguments passed to \samp{polygon}.}
}
\details{
 The fan plot is a variant of the pie chart that places the sectors
 "on top" of each other from the largest to the smallest. By default,
 the largest sector is centered with its circumferential arc upwards,
 giving the plot the appearance of a folding fan. Passing a value for
 \samp{align.at} will place the point of alignment at that angle in 
 radians. The sectors may be aligned at either the left or right edges
 or in the center. Note that \samp{align} must be one of \samp{left right}
 or \samp{center}. Each successive sector is radially "shrunk" by a
 constant amount so that two equal sectors will both be visible.
 
 In cases where there are several segments with very small differences,
 the labels may be crowded. There is a simple routine in the function to
 spread out crowded labels, but it may not be sufficient for severe
 crowding. By capturing the return value and manually altering 
 the label positions, the crowded labels can be separated. This new
 vector of positions may then be passed as \samp{labelpos}.
 
 The calculation of sectors tries to ensure that they are circular. Thus there
 will be white space if the plotting device dimensions are not proportional to
 the size of the plot. The user must adjust the dimensions of the plotting
 device to get the correct appearance.
}
\value{
 The circumferential positions of the labels in radians. These are
 returned in order of decreasing size of the values plotted.
}
\author{Jim Lemon, Anupam Tyagi}
\seealso{\link{floating.pie}}
\examples{
 # IUCN counts of threatened species by geographical area
 iucn.df<-data.frame(area=c("Africa","Asia","Europe","N&C America",
  "S America","Oceania"),threatened=c(5994,7737,1987,4716,5097,2093))
 fan.plot(iucn.df$threatened,
  labels=paste(iucn.df$area,iucn.df$threatened,sep="-"),
  main="Threatened species by geographical area",ticks=276)
 # expand the plot to a semicircle
 fan.plot(iucn.df$threatened,max.span=pi,
  labels=paste(iucn.df$area,iucn.df$threatened,sep="-"),
  main="Threatened species by geographical area",ticks=276)
 # expand further to 3/4 of a circle
 fan.plot(iucn.df$threatened,max.span=1.5*pi,
  labels=paste(iucn.df$area,iucn.df$threatened,sep="-"),
  main="Threatened species by geographical area",ticks=276)
}
\keyword{misc}