On Tue, Sep 29, 2009 at 11:09 PM, Dan Kortschak <dan.kortsc...@adelaide.edu.au> wrote: > Hi Deepayan, > > Thanks for that, I had a think (a few hour too late) and came to the > same conclusion. I had wanted to have vertical bars for each of the data > points, I have gone to a straight xyplot and this shows other intersting > information - maybe I want to be able to do both point and bar plots > (the bars show gaps in the bins nicely where the points don't).
Perhaps type = c("l", "h") in xyplot. -Deepayan > I'm thinking there is probably a better way to do it that what I was > trying, a vertical line from y=0 to y=binvalue for each represented bin > seem most sensible, but I'm not sure how to go about this. > > thanks > Dan > > > On Tue, 2009-09-29 at 22:59 -0700, Deepayan Sarkar wrote: >> On Wed, Sep 16, 2009 at 2:02 PM, Dan Kortschak >> <dan.kortsc...@adelaide.edu.au> wrote: >> > Hi, I trying to produce a bar chart describing hits to specific bins by >> > chromosome for a large data set (I am asking here because >> > experimentation with options is precluded due to this - generating the >> > figure takes about an hour): >> > >> > barchart(hits~bin|chromosome, data=hits, horizontal=FALSE, origin=0, >> > lab=c(3,10), layout=c(1,5,5), strip=strip.custom(style=3, bg="grey90", >> > par.strip.text=list(cex=0.5)), as.table=TRUE); >> > >> > I have about 2500 bins for the largest factor and barchart is drawing >> > tick labels for a substantial proportion of these (how many, I can't see >> > since due to the density of the labels). >> >> Probably all 2500 of them. >> >> > My question is how I can get a sane number of labels along the x axis >> > (about 5-10 would be good). I suspect that 'scales' might be the way to >> > go, but I can't see an obvious option to do this. >> >> Basically, barchart has to be convinced that the limits are numeric. >> There are various ways to do that; the simplest is to provide a >> numeric 'xlim', e.g., >> >> df <- data.frame(y = runif(100), x = gl(100, 1)) >> barchart(y ~ x, df, origin = 0) >> barchart(y ~ x, df, origin = 0, xlim = c(0, 101)) >> >> However, you should also rethink the use of barchart for a 2500-level >> factor; at a minimum, consider something like >> >> xyplot(y ~ as.numeric(x), df, type = "h") >> >> -Deepayan > > ______________________________________________ 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.