[R] Adjust barplot to the left

Jim Lemon jim at bitwrit.com.au
Tue Sep 25 14:25:55 CEST 2007


squall44 wrote:
> Hello,
> 
> I have the following problem: I created an ecdf and a barplot. Unfortunatly,
> the bars are not where I would like them to be (please see picture below).
> 
> http://www.nabble.com/file/p12877530/problem.gif 
> ...
> 
> Can anyone tell me how I can adjust the bars to the left?

Hi Tobias (and anyone else who is interested),
This is a rather intriguing request. If there are people out there who 
would like to place the bars in a barplot at arbitrary positions, I 
could rather easily modify "barp" in the plotrix package to do this.
(I've already tried it with the "xpos" argument as a test, and it 
produces nice overlapped bars, if you like that sort of thing.)
However, as a one-off, I would probably not include it in plotrix. I 
attach the perhaps buggy altered code for Tobias if it helps. Use it 
instead of barplot like this:

library(plotrix)
# add your path to the barp.R file to the following
source("barp.R")
barp(height,width=0.2,col="gray",xlim=c(-1.2,4.2),xpos=0:2)

If I get a few requests, I can thrash the code a bit and it will turn up 
in the next version of plotrix.

Jim
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: barp.R
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070925/4758ef5a/attachment.pl 


More information about the R-help mailing list