Re: [R] xlim with barplot

2013-09-23 Thread peter dalgaard
On Sep 23, 2013, at 05:43 , Jim Lemon wrote: > > barplot(tabulate(x,nbins=85)[35:85]) > barplot(tabulate(y,nbins=85)[35:85]) > > This is an underhanded trick to line up the bars as I think you want them. Not all that underhanded! table() with numeric vectors _will_ skip values not present in d

Re: [R] xlim with barplot

2013-09-22 Thread Jim Lemon
On 09/23/2013 01:56 PM, arun wrote: You could try ggplot() as well. library(ggplot2) library(gridExtra) library(plyr) x1<- count(x) y1<- count(y) p1<-ggplot(x1,aes(x=x,y=freq))+geom_bar(stat="identity",colour="gray",fill="red")+xlim(c(35,85))+ theme_bw()+ theme(axis.line=element_line(colour="b

Re: [R] xlim with barplot

2013-09-22 Thread arun
bw()+ theme(axis.line=element_line(colour="black"), panel.grid.major=element_blank(), panel.grid.minor=element_blank(), panel.border=element_blank(),panel.background=element_blank())  grid.arrange(p1,p2,nrow=2) A.K. - Original Message - From: David Arnold To: r-help@r-project.org C

Re: [R] xlim with barplot

2013-09-22 Thread Jim Lemon
On 09/23/2013 12:55 PM, David Arnold wrote: Hi, I want to compare to barplots with same horizontal axis limits. x=c(55,56,57,58,59,60,60,60,61,62,63,64,65) y=c(35,40,45,50,55,60,60,60,65,70,75,80,85) par(mfrow=c(2,1)) barplot(table(x),xlim=c(35,85)) barplot(table(y),xlim=c(35,85)) par(mfrow=c(

[R] xlim with barplot

2013-09-22 Thread David Arnold
Hi, I want to compare to barplots with same horizontal axis limits. x=c(55,56,57,58,59,60,60,60,61,62,63,64,65) y=c(35,40,45,50,55,60,60,60,65,70,75,80,85) par(mfrow=c(2,1)) barplot(table(x),xlim=c(35,85)) barplot(table(y),xlim=c(35,85)) par(mfrow=c(1,1)) But the bars disappear.