[R] Labels on a pyramide

Jim Lemon jim at bitwrit.com.au
Sun Feb 14 12:05:47 CET 2010


On 02/14/2010 01:27 AM, Orvalho Augusto wrote:
> I am using pyramid.plot() from the plotrix package.
>...
> The problem is (1) I do not want plot agelabels on the center and (2)
> I want plot different labels for each pair of the bars (one label for
> masculine and the other feminine).
>
> The data represent the 10 most frequent cancer in a group of individuals.
>

Bueno troglodita,
You have discovered a deficiency in pyramid.plot, and for that you get 
an answer to your question and brand new source code!

source("pyramid.plot.R")

after loading the plotrix package. Use it quickly, for it will be in the 
next version of plotrix and then everyone (todo el mundo, hombre!) will 
be using it.

Jim

# it must be wider than the default to accommodate the long labels
x11(width=10)
par(mar=pyramid.plot(dados$masfr,dados$femfr,
  laxlab=c(0,10,20,30,40),raxlab=c(0,10,20,30,40),
  main="Primeiras 10 cancros mais frequentes por sexo",
  top.labels=c("Masculino", "Tipo de cancro", "Feminino"),
  labels=dados[,c("maslab","femlab")],
  xycol=rep("#8888ff",10),xxcol=rep("#ff88ff",10), gap=25))
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pyramid.plot.R
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100214/d14e9434/attachment.pl>


More information about the R-help mailing list