On Tue, Sep 10, 2013 at 11:33 PM, Robert Lynch <robert.b.ly...@gmail.com>wrote:
> I am sorry to ask what I am sure is a simple question but I am stuck > trying to figure out how different parts of ggplot2 calls interact > > I am plotting using the following code > > ggplot(Chem.comp, aes(Course, GRADE)) + geom_boxplot(notch = TRUE,aes(fill > = COHORT))+ > labs(y ="Grade Points in class", > x = "Chemistry 2 quarter") + > ggtitle(expression(atop("Comparison between ISE cohorts and Peers", > atop(italic("in Chem 2 classes"), "")))) > ylim(0,4.3333)+ > scale_fill_manual(name = "ISE Cohorts &\nComparison groups", > values = > c("blue","red","blue3","red3","blue4","red4")) + > theme(plot.title = element_text(size = 25, face = "bold", colour = > "black", vjust = -1))+ > guides(fill = guide_legend(nrow = 3),byrow = TRUE) > > which give Rplot.jpeg which is has the appropriate title, but the colors > and the wrong are wrong. > > if I comment out the ggtitle() and theme(), or just ggtitle() I get > Rplot01.jpeg which has the right colors but no title and subtitle. Also > the legend is out of order. the first row should read ISE07 CMP07 with 08 > on the second row and 09 the third with a red column and a blue column. > Changing byrow = TRUE to bycol = TRUE does not change the plotting of the > legend nor does byrow=FALSE > > I am asking for help with getting the title and sub-title to both show up > at the same time as the appropriate colors for the different factor levels. > And to get the legend to render so that the legend looks sort of like > ISE07 [redbox ] [bluebox ] CMP07 > ISE08 [red3box][blue3box] CMP08 > ISE09 [red4box] [blue4box] CMP09 > > the exact colors are not important the the vertical > and horizontal alignment is. > > Thanks! > Robert >
______________________________________________ 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.