[R] pie chart in lattice - trellis class

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon May 28 00:21:31 CEST 2007


On 5/27/07, Patrick Giraudoux <patrick.giraudoux at univ-fcomte.fr> 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?

I can confirm that lattice does not produce "trellis" objects
representing pie charts (although I guess it can be made to do so with
a user supplied panel function). However, I don't see how that would
have helped you with the map example, as plotting a "trellis" object
would also include the axes, labels, etc. What you really want is the
ability to draw a circle with differently colored angular segments,
which can be reasonably approximated by polygons. polygon() and
grid.polygon() do these for traditional and grid graphics
respectively.

-Deepayan



More information about the R-help mailing list