Re: [R] pie chart in lattice - trellis class

From: Patrick Giraudoux <>
Date: Mon, 28 May 2007 15:05:07 +0200

Jim Lemon a écrit :
> Patrick Giraudoux wrote:
>> Dear all,
>> After going through the Lattice doc and R-help list and google, I got
>> the feeling that there is no function in lattice or other package to
>> compute a pie chart object of class "trellis". Although pie charts
>> are obviously not considered optimal even in the pie() doc ;-) , pie
>> chart trellis objects would be easy positioned e.g. over a map drawn
>> with the grids package.
>> Can anybody confirm this absence or indicate a package/function able
>> to draw a pie chart object of class trellis?
> Hi Patrick,
> Floating.pie was written to solve this problem, but it only works in
> standard graphics. Perhaps it might help, though.
> Jim

Hey ! Looks like exactly the one I was looking for... For info to other R-users, it can be found in the 'plotrix' package. Meanwhile I had dropped some line codes with the same target, still not fully achieved (the argument center is not taken into account yet... needs one line more).

Thanks a lot!


polycirc2<-function (radius=1, center = c(0, 0), edges = 50, init=pi/2, angle=pi/2)

    circ = NULL
    angles <- seq(init, init+angle, l = edges)     for (i in angles) {

        circ <- rbind(circ, cbind(radius * sin(i), radius * cos(i)))     }
    return(cbind(circ[, 1] + center[1], circ[,2] + center[2])) }



        for (i in 1:length(x)) {


# example
pie2(ex,col=c(1:length(ex))) mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 28 May 2007 - 13:10:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 May 2007 - 14:31:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.