So, I have the following data.frame, and I want to generate two plots in one graph for yval vs. xval, for each zval and type tp. The lef
> df
xval
plot1 <- ggplot(data=df, aes(x=xval, y=yval, group=cond, colour=cond) ) +
geom_smooth(aes(ymin = yval-se, ymax = yval+se,
linetype=cond, colour=cond, fill=cond), stat="identity",
size=1.1) +
scale_colour_hue(l=25) +
ylim(-0.1,1.3) + scale_linetype_manual(values = c('a' = 1,'b' = 2))
plot1 + facet_grid(~ zval, scales="free_y") +
theme(strip.text.x = element_blank(),
strip.background = element_rect(colour="white", fill="white"),
legend.position=c(.9,.75)
)
Tweak the legend.position values to suit your preference.