[R] how can I plot bar plots with all the bars (negative and positive) in the same direction????

John Kane jrkrideau at yahoo.ca
Fri Sep 3 22:28:04 CEST 2010


I believe that you will have to draw them in ggplot2 as someone mentioned or in base graphics.  Here is a rough first attempt that may give you some ideas.
================================
xx <- -3:4
yy <- rep(-3,length(xx))
plot(xx,xx,  type="n", xlim=c(-4, 5))
rect(xx, yy, xx+.5, xx )
================================

--- On Fri, 9/3/10, Zoppoli, Gabriele (NIH/NCI) [G] <zoppolig at mail.nih.gov> wrote:

> From: Zoppoli, Gabriele (NIH/NCI) [G] <zoppolig at mail.nih.gov>
> Subject: [R] how can I plot bar plots with all the bars (negative and positive) in the same direction????
> To: "r-help at r-project.org" <r-help at r-project.org>
> Received: Friday, September 3, 2010, 1:12 PM
> 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