I would like to get the same effect at the ends of the error bar with
geom_errorbarh that I get with geom_errorbar.
I use the following code to generate the data:
n <- 20;
y <- rep(NA,n);
x <- rep(NA,n);
ystd <- rep(NA,n);
xstd <- rep(NA,n);
ywt <- rep(NA,n);
xwt <- rep(NA,n)
for (j in 1:20){
c <- floor(runif(1,min=6,max=25));
yt <- runif(c,min=1,max=100);
xtt <- 2*yt;
yt <- yt + rnorm(c,sd=15);
xt <- xtt + rnorm(2*c,sd=15);
y[j] <- mean(yt);
x[j] <- mean(xt);
ystd[j] <- sd(yt);
xstd[j] <- sd(xt);
ywt[j] <- c;
xwt[j] <- 2*c;
}
then I use the following code to generate the plot
library(ggplot2);
p <- ggplot(data.frame(x=x,y=y,ystd=ystd,xstd=xstd,ywt=ywt,xwt=xwt),
aes(x,
y,
size=sqrt(xwt*ywt)));
p <- p + layer(geom='point');
p <- p + geom_errorbar(aes(ymax=y+ystd,
ymin=y-ystd),
colour='blue',
size=.01,
width=5);
p <- p + geom_errorbarh(aes(xmax=x+xstd,
xmin=x-xstd),
colour='red',
size=.01,
width=5);
p;
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example:
http://gist.github.com/270442
To post: email
ggp...@googlegroups.com
To unsubscribe: email
ggplot2+u...@googlegroups.com
More options:
http://groups.google.com/group/ggplot2