[R] Barchart bar lengths not proportionate

Walmes Zeviani walmeszeviani at hotmail.com
Thu Jan 14 15:49:01 CET 2010


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 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.
> 
> 


-----
..oooO
..................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani at 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.



More information about the R-help mailing list