Re: [R] Pie Chart Labels

2007-09-05 Thread Jim Lemon
Adam Green wrote:
 I am having trouble finding out how to adjust the position of labels on 
 pie charts.  For the small wedges, many of the labels overlap making it 
 impossible to read.  Is there any way to offset the labels so that they 
 don't overlap?
 
Hi Adam,
There are three ways to adjust the positions of labels on a 3D pie chart 
(I'm assuming it's 3D from the word wedges. If not, the following 
should still be useful).

The first is to change the position of the sectors by the start 
argument. Apart from being useful when very large sectors cause 
problems, changing the sector positions can sometimes alleviate minor 
crowding of the labels.

The second is to catch the return value of the pie3D function. This is 
the radial positions at which the labels have been placed. You can then 
alter this vector and pass it as the argument labelpos. In this way 
you can spread out the labels for small sectors.

Finally, you can leave out the labels when you call pie3D and manually 
place labels using the text function. The chart is drawn on a plot 
that spans -1 to 1 in both directions, so it is relatively easy to work 
out where the labels should be.

A word of warning - when I read, For the small wedges, many of the 
labels..., I felt that I should say that pie charts in general, and 3D 
ones in particular, are rarely successful with more than 4 or 5 sectors. 
In the R-news article that included pie3D, I included a pie chart that 
was very difficult for the viewer to extract the information that the 
creator intended. Depending upon what is to be represented, you might 
consider whether another method might be more successful.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Pie Chart Labels

2007-09-04 Thread Adam Green
I am having trouble finding out how to adjust the position of labels on 
pie charts.  For the small wedges, many of the labels overlap making it 
impossible to read.  Is there any way to offset the labels so that they 
don't overlap?

Adam Green
USGS Patuxent Wildlife Research Center 
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Pie Chart Labels

2007-09-04 Thread Greg Snow
The best option is to use a bar chart or dot chart instead of a pie chart.

-Original Message-
From: Adam Green [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch
Sent: 9/4/07 10:21 AM
Subject: [R] Pie Chart Labels

I am having trouble finding out how to adjust the position of labels on 
pie charts.  For the small wedges, many of the labels overlap making it 
impossible to read.  Is there any way to offset the labels so that they 
don't overlap?

Adam Green
USGS Patuxent Wildlife Research Center 
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Pie Chart Labels

2007-09-04 Thread Rolf Turner

On 5/09/2007, at 9:37 AM, Greg Snow wrote:

 The best option is to use a bar chart or dot chart instead of a pie  
 chart.

Right on, Red Freak!!! :-)

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confidenti...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pie initial angle

2007-05-29 Thread Adrian Dusa

Dear all,

I'd like to produce a simple pie chart for a customer (I know it's bad but 
they insist), and I have some difficulties setting the initial angle.
For example:

pie(c(60, 40), init.angle=14)

and 

pie(c(80, 20), init.angle=338)

both present the slices in the same direction, where:

pie(c(60, 40))
pie(c(80, 20))

present the slices in different directions.

I read everything I could about init.angle argument, I even played with 
various formulas to compute it, but I just can't figure it out.
How can I preserve the desired *direction* of the slices?

Many thanks in advance,
Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] pie initial angle

2007-05-29 Thread Gabor Grothendieck
Not sure I understand what you want but the clockwise= argument
of pie determines whether the slice is drawn clockwise or counter
clockwise.

On 5/29/07, Adrian Dusa [EMAIL PROTECTED] wrote:

 Dear all,

 I'd like to produce a simple pie chart for a customer (I know it's bad but
 they insist), and I have some difficulties setting the initial angle.
 For example:

 pie(c(60, 40), init.angle=14)

 and

 pie(c(80, 20), init.angle=338)

 both present the slices in the same direction, where:

 pie(c(60, 40))
 pie(c(80, 20))

 present the slices in different directions.

 I read everything I could about init.angle argument, I even played with
 various formulas to compute it, but I just can't figure it out.
 How can I preserve the desired *direction* of the slices?

 Many thanks in advance,
 Adrian


 --
 Adrian Dusa
 Romanian Social Data Archive
 1, Schitu Magureanu Bd
 050025 Bucharest sector 5
 Romania
 Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2007-05-28 Thread Patrick Giraudoux
Deepayan Sarkar a écrit :
 On 5/27/07, Patrick Giraudoux [EMAIL PROTECTED] 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


Yes indeed. Thats' likely what I am going to do. Anyway, to plot axes, 
labels of sophisticated graphs on maps may be interesting anyway. For 
instance, we are monitoring fox and hare populations in tens of game 
areas. Drawing observations (panel.xyplot) over time and representing 
the trend variations (panel.loess) at the very place on the map where 
the observations were done gives an absolutely interesting view where 
spatial relationships between trends can be visualized.

Patrick

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2007-05-28 Thread Patrick Giraudoux
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!

Patrick


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)))
}
circ-rbind(c(0,0),circ)
return(cbind(circ[, 1] + center[1], circ[,2] + center[2]))
}


pie2-function(x,col=NULL,...){
x-x/sum(x)
xC-cumsum(x)
xC-xC/xC[length(xC)]
init=0
for (i in 1:length(x)) {
angle-x[i]*2*pi
polygon(polycirc2(init=init,angle=angle),col=col[i],...)
init-xC[i]*2*pi
}
}

# example
ex-rpois(10,2)
plot(c(-1,+1),c(-1,+1),type=n,asp=1)
pie2(ex,col=c(1:length(ex)))

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2007-05-28 Thread Ben Bolker
P
 Yes indeed. Thats' likely what I am going to do. Anyway, to plot axes, 
 labels of sophisticated graphs on maps may be interesting anyway. For 
 instance, we are monitoring fox and hare populations in tens of game 
 areas. Drawing observations (panel.xyplot) over time and representing 
 the trend variations (panel.loess) at the very place on the map where 
 the observations were done gives an absolutely interesting view where 
 spatial relationships between trends can be visualized.
 
 Patrick

  There is a floating.pie in the plotrix package, and a hidden
floating.pie.asp function in the ape package.  I agree that grid
objects would be a more elegant way to implement these ...
(The standard argument is that thermometers or mini-barplots
would be a better way to view this information, but I agree that
pie charts seem familiar to people.)  I have the feeling that I've
seen pie-charts-on-maps somewhere ... searching the R Graphics Gallery
for pie also produces the hexbin pie plot (which doesn't
use grid either ...)

  Ben Bolker

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2007-05-28 Thread Christos Hatzis

In case you haven't seen this, there is an example in Paul Murrell's book
that plots temperatures on a map using 'thermometer' charts.  I would
imagine it should be relatively straight forward to combine the floating.pie
function with Paul's grid-base code (but I have not tried it myself).

http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter7.html

See Figure 7.18 and code

-Christos

Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
 



 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Ben Bolker
 Sent: Monday, May 28, 2007 8:51 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] pie chart in lattice - trellis class
 
 P
  Yes indeed. Thats' likely what I am going to do. Anyway, to 
 plot axes, 
  labels of sophisticated graphs on maps may be interesting 
 anyway. For 
  instance, we are monitoring fox and hare populations in 
 tens of game 
  areas. Drawing observations (panel.xyplot) over time and 
 representing 
  the trend variations (panel.loess) at the very place on the 
 map where 
  the observations were done gives an absolutely interesting 
 view where 
  spatial relationships between trends can be visualized.
  
  Patrick
 
   There is a floating.pie in the plotrix package, and a 
 hidden floating.pie.asp function in the ape package.  I agree 
 that grid objects would be a more elegant way to implement these ...
 (The standard argument is that thermometers or 
 mini-barplots would be a better way to view this information, 
 but I agree that pie charts seem familiar to people.)  I have 
 the feeling that I've seen pie-charts-on-maps somewhere ... 
 searching the R Graphics Gallery for pie also produces the 
 hexbin pie plot (which doesn't use grid either ...)
 
   Ben Bolker
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pie chart in lattice - trellis class

2007-05-27 Thread Patrick Giraudoux
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?

Thanks in advance,

Patrick

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pie

2006-10-21 Thread Dietrich Tissen
Hi,

I would like to draw a pie chart. I've already tried out the standard 
pie-function in the GRAPH-package. My question: is there any 'better' 
function or package to draw a pie chart. For example I would like to 
draw a 3D pie chart.

Dietrich Tissen

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] pie

2006-10-21 Thread Marc Schwartz
On Sat, 2006-10-21 at 22:46 +0200, Dietrich Tissen wrote:
 Hi,
 
 I would like to draw a pie chart. I've already tried out the standard 
 pie-function in the GRAPH-package. My question: is there any 'better' 
 function or package to draw a pie chart. For example I would like to 
 draw a 3D pie chart.
 
 Dietrich Tissen

Take a look at the plotrix package on CRAN.

That being said, just say NO to 3D pie charts:

When a graphic is taken over by decorative forms of computer debris,
when the data measures and structures become Design Elements, when the
overall design purveys Graphical Style rather than quantitative
information, then the graphic may be called a duck in honor of the
duck-form store... 

   — Edward Tufte


The primary source of extraneous lines in charting graphics today are
the 3-D options offered by conventional spreadsheet graphics. These 3-D
options serve no useful purpose; they add only ink to the chart, and
more often than not make it more difficult to estimate the values
represented. Even worse are the spreadsheet options that allow one to
rotate the perspective. For those who would take bad graphical display
to even higher levels, the Excel spreadsheet program offers the option
of doughnut, radar, cylinder, cone, bubble charts.

   — Gary Klass



Consider a ?dotchart or even ?barplot instead.


For more information:

http://lilt.ilstu.edu/gmklass/pos138/datadisplay/badchart.htm

http://lilt.ilstu.edu/gmklass/pos138/datadisplay/sections/goodcharts.htm

http://www.edwardtufte.com/tufte/books_vdqi

and the two books by Cleveland:

http://stat.bell-labs.com/wsc/index.html


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pie() with only 180°

2006-10-01 Thread Thomas Steiner
I want to plot the results of today's elections in Austria in this
typical 180°-piechart (and not 360°).
Unfortunantely pie() has just an argument init.angle and no end.angle.
Perhaps you know a workaround.
Thomas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] pie() with only 180°

2006-10-01 Thread Anupam Tyagi
Thomas Steiner finbref.2006 at gmail.com writes:

 
 I want to plot the results of today's elections in Austria in this
 typical 180°-piechart (and not 360°).
 Unfortunantely pie() has just an argument init.angle and no end.angle.
 Perhaps you know a workaround.
 Thomas

Please look up the function fan.plot Jim Lemmon had posted last month in reply
to a question by me. You may be able to tweak that and make 180-degree plots.
Anupam.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pie charts as symbols

2003-07-17 Thread Adam Langley
Hello All
I am looking at a way of plotting a series of pie charts at specified
locations on an existing plot. The size of the pie chart would be proportion
to the magnitude of the total value of each vector (x) and the values in x
are displayed as the areas of pie slices. I am essentially trying to
replicate what many GIS packages do.
Symbols (using a circle) gets me part way there, but doesn't subdivide the
area of the symbol. I can see that I could utilise some of the existing code
in the pie function to achieve this but is there an existing function that I
could use or does anyone have an elegant solution?

Thanks in advance.

Adam 


---



 

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] pie charts?

2003-02-13 Thread Joshua Gramlich
I don't suppose it's possible to create a pie chart in R?  I've got 1500
some odd elements in a frame that are valued at either -1, 0 or 1 and
I'd like to find a reasonable way to represent the distribution
graphically...any ideas?


Joshua Gramlich
Piocon Technologies
Chicago, IL

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] pie charts?

2003-02-13 Thread Joshua Gramlich
I did find ?pie and saw the explanation as to why not to use pie
charts.  I may end up using it anyway, because the comparison is
something like 94%,5%,1%, so the difficulty of the human eye to read
area as opposed to length(as in a bar chart) doesn't make much
difference in this case.

Thanks for the reply.


Joshua Gramlich



On Thu, 2003-02-13 at 16:33, Marc Schwartz wrote:
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]] On Behalf Of Joshua Gramlich
 Sent: Thursday, February 13, 2003 4:17 PM
 To: [EMAIL PROTECTED]
 Subject: [R] pie charts?
 
 
 I don't suppose it's possible to create a pie chart in R?  
 I've got 1500 some odd elements in a frame that are valued at 
 either -1, 0 or 1 and I'd like to find a reasonable way to 
 represent the distribution graphically...any ideas?
 
 
 Joshua Gramlich
 Piocon Technologies
 Chicago, IL
 
 
 You can. See ?pie.
 
 However, I believe the general disposition would be to not do so.
 
 You would probably be better off with either a bar chart (see ?barplot
 in base R or ?barplot2 in the gregmisc package) or perhaps a Cleveland
 dot plot (see ?dotchart in base R) depending upon what you might wish
 to show.  barplot2() has some additional features like plotting
 confidence intervals if you wish to include these in your graphic.
 
 The reasoning behind this is covered in W.S. Cleveland's Elements of
 Graphing Data on pages 262 - 264 in the section dealing with what he
 calls Pop Charts.
 
 Hope that helps,
 
 Marc Schwartz
 
 __
 [EMAIL PROTECTED] mailing list
 http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help