[R] Plotting pairs of bars

Greg Snow Greg.Snow at imail.org
Tue May 5 18:55:23 CEST 2009


Look at the beside argument to the barplot function.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Steve Murray
> Sent: Tuesday, May 05, 2009 9:52 AM
> To: r-help at r-project.org
> Subject: [R] Plotting pairs of bars
> 
> 
> Dear all,
> 
> I have a matrix called combine86 which looks as follows:
> 
> > combine86
>              Sim Mean   Obs Mean  Sim Sum Obs Sum
> AMAZON      1172.0424  1394.44604  553204  659573
> NILE         262.4440   164.23921   67973   41881
> CONGO        682.8007   722.63971  205523  214624
> MISSISSIPPI  363.0758   142.59883  124535   49054
> AMUR         143.5857    89.30434   36040   22594
> PARANA       702.3793   388.03030  162952   89635
> YENISEI      208.1396   174.52722   83464   70509
> OB           197.0399   162.82697   79013   63991
> LENA         118.1100    77.49638   48307   32161
> NIGER        374.8258   212.25714   66719   37145
> ZAMBEZI      500.0000   485.87610   57000   54904
> YANGTZE      358.4172   256.80246   58422   41602
> 
> 
> For each of the rivers (which are the row names of this matrix), I wish
> to plot a bar for Simulated Mean and another for the Observed Mean. So
> far I've only been able to get R to stack the bars (using 'barplot) on
> top of one another, which isn't really what I want! I was hoping more
> for a pairing of bars (one 'Sim' and one 'Mean') followed by a gap,
> then the next pair of bars for the next river, a gap, and so on. Is
> this possible to do in R? If so, how?!
> 
> Many thanks,
> 
> Steve
> 
> 
> _________________________________________________________________
> [[elided Hotmail spam]]
> 
> ______________________________________________
> 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