[R] how can I plot bar plots with all the bars (negative and positive) in the same direction????
Robert Baer
rbaer at atsu.edu
Fri Sep 3 21:17:59 CEST 2010
As is often the case in R, just because you shouldn't do something, doesn't
mean you can't do it. Still, I'd urge you to consider the "visual honesty"
of what you propose.
If you're still insistent:
dat <- (-3:4)
dat1=dat-min(dat)
barplot(dat1,axes=FALSE)
axis(2,dat1,labels=dat)
Typically, zero is a reference point and/or the identity element for
addition. Your plot audience will interpret it this way. If you want to
look at difference scores from the minimal value, shouldn't that be exactly
how you label your y-axis, and not with the pre-transformed numbers?
Are you still sure you don't like the default behavior?
Rob Baer
----- Original Message -----
From: "Zoppoli, Gabriele (NIH/NCI) [G]" <zoppolig at mail.nih.gov>
To: <r-help at r-project.org>
Sent: Friday, September 03, 2010 12:12 PM
Subject: [R] how can I plot bar plots with all the bars (negative and
positive) in the same direction????
> 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?
>
> Thanks!
>
>
> Gabriele Zoppoli, MD
> Ph.D. Fellow, Experimental and Clinical Oncology and Hematology,
> University of Genova, Genova, Italy
> Guest Researcher, LMP, NCI, NIH, Bethesda MD
>
> Work: 301-451-8575
> Mobile: 301-204-5642
> Email: zoppolig at mail.nih.gov
> ______________________________________________
> 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.
>
More information about the R-help
mailing list