Re: [R] Overlapping x axes using Lattice

From: Breheny, Patrick <patrick.breheny_at_uky.edu>
Date: Tue, 03 May 2011 17:44:39 -0400

I'm not clear on what you're looking for here. Your x-axis is numeric, why are you converting it to a factor? If you keep it numeric, the labels don't overlap. Or perhaps you don't want it to be numeric, in which case why not just change the aspect ratio of the plot until they no longer overlap? Or change the axis font size? Or put fewer labels on the axis? There is a finite amount of space on the axis, so you have to either make more space, shrink the labels, or draw fewer of them.

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Andrew McFadden Sent: Tuesday, May 03, 2011 5:05 PM
To: r-help_at_r-project.org
Subject: [R] Overlapping x axes using Lattice

Hi R users

I apologise in advance for this question as I suspect it is simple and perhaps others have had this problem.
I am struggling to sort out how to fix the x axes so that the labels don't overlap.

I have put the following example together to show my problem.

library(lattice)

titre <- as.factor(rep(c(10999,20999,30999,40999,50999,60999,

20000,40000,45000,50000,70000,80000),c(2,2,2,2,1,1,2,2,2,2,1,1)))
test<-rep(c("BVD","HSD"),c(10,10))
age<-as.factor(rep(c(1,2,3,4),c(5,5,5,5)))

pesti<-data.frame(titre,test,age)

histogram(~pesti[,1]|pesti[,2]+ pesti[,3] ,alternating=TRUE,tick.number=1,
stack=TRUE,type = "count", xlab="VNT",rot=c(180,180),draw=FALSE)

Thank you in advance.

Andy

Andrew McFadden MVS BVSc
Incursion Investigator

Investigation & Diagnostic Centres - Wallaceville Biosecurity New Zealand Ministry of Agriculture and Forestry

Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St Upper Hutt

This email message and any attachment(s) is intended solely for the addressee(s) named above. The information it contains is confidential and may be legally privileged. Unauthorised use of the message, or the information it contains, may be unlawful. If you have received this message by mistake please call the sender immediately on 64 4 8940100 or notify us by return email and erase the original message and attachments. Thank you.

The Ministry of Agriculture and Forestry accepts no responsibility for changes made to this email or to any attachments after transmission from the office.

        [[alternative HTML version deleted]]



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.

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 Thu 05 May 2011 - 06:25:04 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 Thu 05 May 2011 - 07:00:05 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