Gavin,

Thank you for this example.  I would use the as.pyramidLikert function in
the HH package.
The resulting plot is a standard lattice plot, so any fine tuning uses that
standard lattice features.

Rich


> ## install.packages("HH")  ## if necessary
> library(HH)
> mydata <- cbind(mpop,fpop)[10:1,]
> dimnames(mydata) <- list(coh, c("males","females"))
> mydata
      males females
0-9      20      30
10-19    40      50
20-29    60      60
30-39    85      85
40-49    90      90
50-59   110     110
60-69   100     100
70-79    80      80
80-89    75      75
90-99    50      50
> as.pyramidLikert(plot.likert(mydata))
> print(as.pyramidLikert(plot.likert(mydata)), panel.width=.45)
> update(as.pyramidLikert(plot.likert(mydata)), scales=list(cex=2))
> print(update(as.pyramidLikert(plot.likert(mydata)), scales=list(cex=2)),
panel.width=.42)
>
> packageVersion("HH")
[1] ‘2.2.23’

---------- Forwarded message ----------
From: Gavin Rudge <g.ru...@bham.ac.uk>
Date: Thu, Apr 12, 2012 at 7:55 AM
Subject: [R] pyramid.plot in plotrix, axis labelling
To: "r-help@r-project.org" <r-help@r-project.org>


Hi, I've been looking at ways to make pyramid plots in R.  I like the
pyramid.plot method in plotrix as it seems the simplest to use and building
them in ggplot looks a bit more code intensive than I'd like, being as I'm
new to R.  This package does pretty much what I need it to do, however I
can't seem to scale the x axis labels.  The other labels scale fine with
labelcex.

I guess the preferred method is to remove them and re-build them as you
might in the base package, but I have no idea how to refer to them as there
are two of them.

I have enclosed some sample data lifted from another example.  I've scaled
down the other labels using labelcex whch leaves the disparity in sizes
that I'm trying to remove.  I'd like something like this but with the x
axis lables the same size as the y.


> mpop=c(50,75,80,100,110,90,85,60,40,20)
> fpop=c(50,75,80,100,110,90,85,60,50,30)
>
coh=c("0-9","10-19","20-29","30-39","40-49","50-59","60-69","70-79","80-89","90-99")
>
pyramid.plot(mpop,fpop,labels=coh,gap=15,labelcex=0.7,top.labels=c("males","age
group","females"),lxcol="red",rxcol="blue",
laxlab=c(0,50,100,150),raxlab=c(0,50,100,150))



Any suggestions gratefully recieved.



Gavin.

______________________________________________
R-help@r-project.org 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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to