Thank you for the three (!) solutions suggested. I found that the base 
subtraction trick worked well, but I investigated all three:

offset, I found, referred to moving bars on the x-axis. Great for line plot 
jitter when they're overlapping, but not the problem I was trying to solve 
here. Sorry if it was my lack of clarity.

ggplot...I have used that package, but could not find a ggplot or ggplot2 
command in the CRAN reference manual. I tweaked a bit and will benefit from 
some of the specifications you happen to make in there that will pretty-fy the 
chart, but the other solution was just too easy in comparison.

Another option I had not thought of was to make one of these broken y charts 
(e.g., http://community.qlikview.com/ideas/1912) that better discloses the true 
range while still magnifying the otherwise-difficult-to-see effect. Not that I 
figured out that one either, mind you, but it occurred to me later!

Thanks all for the many ideas. I'll include a data matrix if there is a next 
round as well.

Best,

Nikky


On Mon, Jun 3, 2013 at 7:55 AM, David Carlson 
<dcarl...@tamu.edu<mailto:dcarl...@tamu.edu>> wrote:
I believe you are looking for the offset= parameter. Consider the
following:

barplot(c(2, 3), ylim=c(1, 3))
barplot(c(2, 3), ylim=c(1, 3), offset=1)

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>
[mailto:r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>] On 
Behalf Of Nicole Prause
Sent: Friday, May 31, 2013 11:31 AM
To: r-help@r-project.org<mailto:r-help@r-project.org>
Subject: [R] Y-lim minimum overrun in barplot

The code below produces the plot hosted here:
http://www.span-lab.com/ChartStop.jpeg

    error.bar <- function(x, y, upper, lower=upper, length=0.1,...){
    if(length(x) != length(y) | length(y) !=length(lower) |
length(lower) != length(upper))
    stop("vectors must be same length")
    arrows(x,y+upper, x, y-lower, angle=90, code=3, length=length,
...)
    }

Means<-tapply(data$IntercourseIntention,data$FilmAndOrder,mean)
SDs<-tapply(data$IntercourseIntention,data$FilmAndOrder,sd)
b<-barplot(Means,col=c("gray","tan1","blue","white"),axis.lty=1,ylim
=c(2,3),names.arg=c("","","",""),ylab="Intercourse
intention",xlab="Film and condition")
legend("topleft",c("Pre drink, Neutral","Post drink,
Neutral","Pre-drink, Sexual", "Post-drink,
Sexual"),col=c("gray","tan1","blue","white"),pch=15)
error.bar(b,Means, 1.96*SDs/10)

(I know it's not pretty yet. To be fixed after the initial display
is reasonable!) The y average value minimum truly is 1.2, but even
ylim=c(1,X) produces this behavior of the bars running over the
x-axis. I should be able to specify the starting value regardless of
the range. Does anyone see the code bit I'm missing here?

Much appreciated!

Nikky

****************************
Nicole Prause, PhD
Research faculty
Department of Psychiatry
760 Westwood Blvd
University of California
Los Angeles, CA 90024
npra...@mednet.ucla.edu<mailto:npra...@mednet.ucla.edu><mailto:npra...@mednet.ucla.edu<mailto:npra...@mednet.ucla.edu>>
www.span-lab.com<http://www.span-lab.com><http://www.span-lab.com>

________________________________

IMPORTANT WARNING: This email (and any attachments) is
o...{{dropped:12}}

______________________________________________
R-help@r-project.org<mailto:R-help@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.




--
****************************
Nicole Prause, PhD
Research faculty
Department of Psychiatry
760 Westwood Blvd
University of California
Los Angeles, CA 90024
npra...@mednet.ucla.edu<mailto:npra...@mednet.ucla.edu>
www.span-lab.com<http://www.span-lab.com>

________________________________

IMPORTANT WARNING: This email (and any attachments) is only intended for the 
use of the person or entity to which it is addressed, and may contain 
information that is privileged and confidential. You, the recipient, are 
obligated to maintain it in a safe, secure and confidential manner. 
Unauthorized redisclosure or failure to maintain confidentiality may subject 
you to federal and state penalties. If you are not the intended recipient, 
please immediately notify us by return email, and delete this message from your 
computer.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to