Hi ggplot group,
I've been trying to fix a bug in my forest plots for a few weeks now (officially driving me crazy).
The problem is that the axes do not pop out uniformly scaled. Seems like multiple things are going on here, even though the plot only needs 1 line of code from the R-bloggers tutorial: http://www.r-bloggers.com/forest-plots-using-r-and-ggplot2/
The bars are oftentimes placed with flipped signs so that they don't fall on the mean value. Even the zero hline() isn't on the right scale. I've tried using geom_errorbar() instead and scaling options, but I'm throwing in the towel. Does anyone have any suggestions? I think something's up with my data frame. Code is below.
Best,
Katie
___
Katie Planey
Stanford Biomedical Informatics
Butte Lab | http://buttelab.stanford.edu/
p <-ggplot(data, aes(x=study_names,y=g,ymin=gMin,ymax=gMax)) +geom_pointrange() + geom_hline(aes(x=0), lty=2) + coord_flip()
plot(p)
#My dataset is below - it's effect sizes (g) and max/min (g+ standard deviation) for a meta-analysis of microarray data from different studies.
#I just created a data frame with the relevant statistics:
data <- structure(list(study_names = structure(1:9, .Names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), .Label = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), class = "factor"),
g = structure(c(1L, 8L, 6L, 3L, 2L, 4L, 9L, 7L, 5L), .Names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), .Label = c("-0.0880224564200254",
"-0.293760093370228", "-0.297381677328331", "-0.303845191315",
"-0.307510645327556", "-0.426248689072173", "-0.590197752144345",
"-0.60072930481096", "-1.13419569672925"), class = "factor"),
gMax = structure(c(9L, 6L, 3L, 4L, 8L, 2L, 7L, 5L, 1L), .Names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), .Label = c("-0.0644600967202706",
"-0.0646476363654359", "-0.10990976467328", "-0.166274833020161",
"-0.203680097076338", "-0.321207868946344", "-0.539150356441367",
"0.217241161839879", "0.289255627935715"), class = "factor"),
gMin = structure(c(2L, 7L, 5L, 1L, 6L, 3L, 9L, 8L, 4L), .Names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), .Label = c("-0.428488521636501",
"-0.465300540775766", "-0.543042746264564", "-0.550561193934842",
"-0.742587613471065", "-0.804761348580336", "-0.880250740675576",
"-0.976715407212353", "-1.72924103701714"), class = "factor"),
se.g = structure(c(6L, 4L, 5L, 1L, 8L, 2L, 9L, 7L, 3L), .Names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), .Label = c("0.13110684430817",
"0.239197554949564", "0.243050548607286", "0.279521435864616",
"0.316338924398893", "0.377278084355741", "0.386517655068008",
"0.511001255210108", "0.595045340287887"), class = "factor"),
study_names = c("GSE19615_GPL570_g", "GSE19697_GPL570_g",
"GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g", "GSE25065_GPL96_LBJ_g",
"GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g", "GSE25065_GPL96_PERU_g",
"GSE25065_GPL96_USO_g"), study_sizes = c(20, 24, 42, 99,
8, 28, 6, 10, 6)), .Names = c("study_names", "g", "gMax",
"gMin", "se.g", "study_names", "study_sizes"), row.names = c("GSE19615_GPL570_g",
"GSE19697_GPL570_g", "GSE22226_GPL1708_g", "GSE25055_GPL96_MDACC_M_g",
"GSE25065_GPL96_LBJ_g", "GSE25065_GPL96_MDACC_g", "GSE25065_GPL96_MDACC_MDA_g",
"GSE25065_GPL96_PERU_g", "GSE25065_GPL96_USO_g"), class = "data.frame")
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example:
https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggplot2-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe: email ggplot2+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
More options:
http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit
https://groups.google.com/groups/opt_out.