Hi again!
I have two questions/issues with gplot
1) New error on previously fine code, and 2) changing y-axis limits makes CI bands wonky.
Error 1
I am struggling now with a new error that popped up between now and yesterday. Code worked fine, nothing changed, now I get an error.
Error in structure(list(call = match.call(), aesthetics = aesthetics, :
object 'rescale_none' not found
I have been running this type of code with this "object" for two years with no issues. Now this happens. Here is my code to generate a plot that shows changes in annual and perennial grass cover over time, with SE bars at each event monitoring point (this might look familiar).
ggplot(means2, aes(x = Monitoring.Event, y = mean, color = Grass.Type)) +
geom_errorbar(aes(ymin=mean - se, ymax=mean + se), width=2, size = 1) +
geom_line(aes(colour=Grass.Type), size = 1.25) +
geom_point(aes(colour= Grass.Type), size = 4) +
facet_wrap (~Treatment, nrow=1) + scale_y_continuous(oob=rescale_none) +
xlab("Monitoring Week (8/14/2013 - 5/5/2014)") + ylab("Mean Percent Cover (w/ SE bars)") +
ggtitle("Mean cover each monitoring week, August watering") +
scale_x_continuous(breaks=c(seq(1,25,by=3))) +
scale_fill_discrete(name="Grass Type", breaks=c("Annual grass","Native grass"), labels=c("Annual Grass Cover","Perennial Grass Cover")) +
scale_colour_discrete(name="Grass Type", breaks=c("Annual grass","Native grass"), labels=c("Annual grass cover","Native grass cover")) + #what the names of columns are, and then what I want them to be on the legend
theme(panel.grid.major.x = element_blank() ,
strip.text.x = element_text(face = "bold", size=20),
strip.background = element_rect(colour="blue", fill="#CCCCFF"),
plot.title = element_text(face="bold", size=30),
axis.title.x = element_text(face="bold", size=20),
axis.text.x = element_text(face="bold", size=10),
axis.title.y = element_text(face="bold", size=20),
axis.text =element_text(face="bold", size=20),
legend.text=element_text(face="bold", size=25),
legend.title=element_text(size=30))
Error 2
There are thre questions embedded in this error:
1) I have a similar graph, only now with Confidence Intervals instead of SE bars. Worked fine, except that my CIs extend below 0, and grass cover cannot be < 0. I try to apply limits, and all of a sudden my CIs no longer match up to the points/lines.
2) Also, I am now getting the same error (Error 1, above) with this graph too.
3) Finally, there are two legends, and when I try to apply a change in text style, I get an error. I assume it is because I have two legend components, but am not actually sure.
I can get pieces of the code to work, but cannot put it all together.
Here is my code:
ggplot(data=KIN.Aug.Per.Seed.sum) +
geom_ribbon(aes(x=Monitoring.Event, ymin=lower, ymax = upper, fill =Per.Ann), alpha=0.5) +
geom_line(aes(x=Monitoring.Event,y=mean, col=Per.Ann), size = 1.25) + geom_point(aes(x=Monitoring.Event,y=mean, colour = Per.Ann), size = 4) +
facet_wrap (~Treatment, nrow=1) + scale_y_continuous(oob="rescale_none") +
xlab("Monitoring Week (8/14/2013 - 5/5/2014)") + ylab("Mean Percent Cover (+- 2sd)") +
scale_x_continuous(breaks=c(seq(1,25,by=3))) + scale_y_continuous (oob = rescale_none) +
ggtitle("Mean Cover each monitoring week, August watering") +
scale_fill_discrete(name="Grass Type", breaks=c("Annual grass","Native grass"), labels=c("Annual Grass Cover","Perennial Grass Cover")) +
scale_colour_discrete(name="Grass Type", breaks=c("Annual grass","Native grass"), labels=c("Annual grass cover","Perennial grass cover") +
theme(panel.grid.major.x = element_blank() ,
strip.text.x = element_text(face = "bold", size=20),
strip.background = element_rect(colour="blue", fill="#CCCCFF"),
plot.title = element_text(face="bold", size=30),
axis.title.x = element_text(face="bold", size=20),
axis.text.x = element_text(face="bold", size=10),
axis.title.y = element_text(face="bold", size=20),
axis.text =element_text(face="bold", size=20),
legend.text=element_text(face="bold", size=25),
legend.title=element_text(size=30))
Attached an idea of what it currently looks like (because apparently today I cannot copy and paste an image into an email), when I walk through functional pieces.
One last note: Only thing that is different between last night and this morning is my computer performed "updates", without my permission (Plant Sciences IT overrode my preferences, and now I cannot control my computer - thanks guys!).
Thank you everyone for your thoughts and suggestions. I realize this is probably a super-simple fix but I as supposed to have a meeting this morning, armed with these graphs, and now I can't get them in the form they should be!