Re: [R] reducing the number of x-axis lables in a bwplot while plotting all boxes

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri, 29 Feb 2008 17:50:04 +0000

On 1/7/08, Jeff D. Hamann <jeff.hamann_at_forestinformatics.com> wrote:
> I apologize if this is somewhere in the archives, but I can't seem to find
> a solution to this question.
>
> I've been trying to plot a bwplot:
>
> print(
> bwplot( n.pareto ~ as.factor(gen) | mut.rate * n.pop,
> data=p6,
> horizontal=FALSE,
> box.ratio=0.75,
> cex=0.6,
> xlim=c(-1,51),
> ylim=c(-1,500),
> layout=c(3,3),
> index.cond=list(c(1,2,3),c(3,2,1)),
> panel = function(...) {
> panel.grid(v = -1, h = -1)
> cex=0.05
> panel.bwplot(...)
> panel.abline(h=486,lty=2)
> },
> main="Non-dominated Pareto Optimal Solutions",
> ylab="Non-dominated Solutions in the Pareto Archive",
> xlab="Generation" )
> )
>
> which works "fine", but... I have tried almost every combination of
> pertinent arguments for reducing the number of ticks/lables while still
> plotting all the boxes in each panel. The levels of "gen" are:
>
> > levels( as.factor(p6$gen ))
> [1] "20" "40" "60" "80" "100" "120" "140" "160"
> [9] "180" "200" "220" "240" "260" "280" "300" "320"
> [17] "340" "360" "380" "400" "420" "440" "460" "480"
> [25] "500" "520" "540" "560" "580" "600" "620" "640"
> [33] "660" "680" "700" "720" "740" "760" "780" "800"
> [41] "820" "840" "860" "880" "900" "920" "940" "960"
> [49] "980" "1000"
> >
>
> which creates a "smear" of labels across the x axis. My problem is that I
> would like to only print five or 10 of the labels (i.e.
> 20,100,200,...,900) or something to make the labels readable and still
> plot all the boxes in each panel.
>
> Is there something I'm missing as a result conditioning on two factors. I
> feel like such a newbie about this... ugh... Any hints, please?

You can supply blank labels; e.g.,

xlim = c("20", "", "", "", "100", ...)

-Deepayan



R-help_at_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. Received on Fri 29 Feb 2008 - 17:53:09 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 Fri 29 Feb 2008 - 18:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive