Hi All, Will try and keep brief, excuse the poor graphics skills, first time using GIMP. I would like to make the first one look (somewhat) like the second if possible. From: http://d.imagehost.org/0519/Screen_shot_2010-12-08_at_3_50_23_PM.png To here: http://d.imagehost.org/0293/Screen_shot_2010-12-08_at_3_50_23_PM2.png I imagine the line going over the top with the p-values is probably not doable? But how about the sort of 'second tier' of labeling on the x axis? I know there is a legend but I'd like to have the graph without the legend as I think the second shows things a better than the first. At first I thought the 'var1var2' variable was redundant, but if I use the var2 alone then the two A's go first followed by the two B's, so I need that labeling to keep them in order as far as I can see. If I can get the second tier of labeling sorted then that will be enough as I can put the p-values in there worst case. Was also hoping to have 1A and 1B closer together and 2A and 2B closer so it looked more like what it is (two groups of two) than it does (one group of four). Code to generate the first: library(ggplot2) figure4 <- data.frame(cen = c(0.057126,0.040649,0.080966,0.027876), min c(0.041141,0.022242,0.057944,0.016731), max c(0.079322,0.07429,0.113136,0.046444), var1 = c("1","1","2","2"), var2 c("A","B","A","B"), var1var2 = c("1A","1B","2A","2B")) ggplot(figure4, aes(var1var2, cen, ymin = min, ymax=max, linetype=var1)) + scale_linetype_manual(values = c(1,3)) + geom_pointrange() + geom_errorbar(width=0.2) + opts(title="Title goes here") + labs(x="Var2", y="Y units", linetype="Var1") Thanks Matt [[alternative HTML version deleted]]
baptiste auguie
2010-Dec-08 08:50 UTC
[R] ggplot - line_range help, second tier axis label
Hi, The easiest way to get the wide curly braces in your plot might be the tikzDevice package. In its vignette you'll find an example of placing an arbitrary tikz element in a plot, featuring a curly bracket. Sadly, the internal coordinate system used by ggplot2 might make the positioning a little difficult than with base or lattice graphics. HTH, baptiste On 8 December 2010 09:10, Matt Cooper <mattcstats at gmail.com> wrote:> Hi All, > > Will try and keep brief, excuse the poor graphics skills, first time using > GIMP. I would like to make the first one look (somewhat) like the second if > possible. > > From: http://d.imagehost.org/0519/Screen_shot_2010-12-08_at_3_50_23_PM.png > To here: > http://d.imagehost.org/0293/Screen_shot_2010-12-08_at_3_50_23_PM2.png > > I imagine the line going over the top with the p-values is probably not > doable? But how about the sort of 'second tier' of labeling on the x axis? I > know there is a legend but I'd like to have the graph without the legend as > I think the second shows things a better than the first. At first I thought > the 'var1var2' variable was redundant, but if I use the var2 alone then the > two A's go first followed by the two B's, so I need that labeling to keep > them in order as far as I can see. > > If I can get the second tier of labeling sorted then that will be enough as > I can put the p-values in there worst case. > > Was also hoping to have 1A and 1B closer together and 2A and 2B closer so it > looked more like what it is (two groups of two) than it does (one group of > four). > > Code to generate the first: > > library(ggplot2) > figure4 <- data.frame(cen = c(0.057126,0.040649,0.080966,0.027876), min > c(0.041141,0.022242,0.057944,0.016731), max > c(0.079322,0.07429,0.113136,0.046444), var1 = c("1","1","2","2"), var2 > c("A","B","A","B"), var1var2 = c("1A","1B","2A","2B")) > ggplot(figure4, aes(var1var2, cen, ?ymin = min, ymax=max, linetype=var1)) + > scale_linetype_manual(values = c(1,3)) + geom_pointrange() + > geom_errorbar(width=0.2) + opts(title="Title goes here") + labs(x="Var2", > y="Y units", linetype="Var1") > > Thanks > Matt > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >