I think you should rather look at the origin= parameter in barchart. See ?panel.barchart for a discussion of this exact problem: " origin: the origin for the bars. For grouped displays with 'stack = TRUE', this argument is ignored and the origin set to 0. Otherwise, defaults to 'NULL', in which case bars start at the left (or bottom) end of a panel. This choice is somewhat unfortuntate, as it can be misleading, but is the default for historical reasons. For tabular (or similar) data, 'origin = 0' is usually more appropriate; if not, one should reconsider the use of a bar chart in the first place (dot plots are often a good alternative). "
The result of setting origin is more sensible: require(lattice) da <- expand.grid(A=c("a","b"), x=1:4) da$y <- c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, origin=0) >>> Walmes Zeviani <walmeszevi...@hotmail.com> 14/01/2010 14:49:01 >>> Rex, I think this problem can be solved using xlim()/ylim() argument. Look at the follwing code: require(lattice) da <- expand.grid(A=c("a","b"), x=1:4) da$y <- c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, ylim=c(0, 1.05*max(da$y))) At your disposal. Walmes. Rex C. Eastbourne wrote: > > When I use barchart (with default formatting options), I get bars whose > lengths/heights are not proportional to their value. For example: > > http://drop.io/wbagm6s/asset/capture-png > > Many of the values in this chart are 1; however, because the blue bars > extend to the left of the "0" tick mark, those bars appear to represent > higher numeric values. Is there a way to make the length of the bar > proportional to the data value, so that people looking at my chart are not > misled? > > Thanks, > > Rex > > [[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. > > ----- ..oooO .................................................................................................. ..(....)... 0ooo... Walmes Zeviani ...\..(.....(.....)... Master in Statistics and Agricultural Experimentation ....\_)..... )../.... walmeszevi...@hotmail.com, Lavras - MG, Brasil ............ (_/............................................................................................ -- View this message in context: http://n4.nabble.com/Barchart-bar-lengths-not-proportionate-tp1013702p1013918.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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. ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ 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.