[R] how can I plot bar plots with all the bars (negative and positive) in the same direction????
David Winsemius
dwinsemius at comcast.net
Fri Sep 3 19:58:30 CEST 2010
On Sep 3, 2010, at 1:12 PM, Zoppoli, Gabriele (NIH/NCI) [G] wrote:
> Dear r-help mailing list,
>
> this seems stupid, but I actually don't find the solution:
>
> if I have a vector of numbers x of length n, ranging, say, from -3
> to 4, if I do
>
> barplot (x)
>
> all the values below 0 go downwards, and all the positive values go
> upward. How can I make them all begin from the minimum pointing
> upwards?
>
> grp.n <-c(0, -1, -2, -3, -5, -1, 3, -2, 2, 0)
> barplot(grp.n-min(grp.n), axes=FALSE)
> axis(2, grp.n-min(grp.n), labels=as.character(grp.n))
Compare
> barplot(grp.n, axes=FALSE)
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list