Web EndMemo

R Pie Chart Plot


pie(...) funtion plot a pie chart. It's usage is:

pie(x, labels = names(x), edges = 200, radius = 0.8,
    clockwise = FALSE, init.angle = if(clockwise) 90 else 0,
    density = NULL, angle = 45, col = NULL, border = NULL,
    lty = NULL, main = NULL, ...)

x: Vector of each pie slice areas
labels: Vector of Pie slice names
edges: Pie circle border
radius: Pie circle radius
clockwise: Data direction, default is not clockwise
...

First let's make a simple pie chart:
>x <- c(3,2,6,8,4)
>Pie(x)


Let's add some annotations, including a title (main=), color (col=), pie slice names (labels=), etc:
>pieplot(x,labels=c("Jan","Feb","Mar","Apr","May"),xlab="Month",
+ ylab="Revenue", col=c("tan2","darkslategray3","blue","red","green"),
+ density=c(0,5,20,50,100), main="Soft Revenue")