#1 lettuce<-read.csv2("lettuce.csv") summary(lettuce) #2-4 # svg("hist.svg", 7,6) png("hist.png", 7*300,6*300, res=300) par(mfrow=c(2,1)) hist(lettuce$harv.days[lettuce$leaf.col=="red"], main=NULL, xlim=c(50, 70)) hist(lettuce$harv.days[lettuce$leaf.col=="green"], main=NULL,xlim=c(50, 70)) dev.off() #5 par(mfrow=c(1,1)) #6 names(lettuce) library(ggplot2) ggplot(data=lettuce, mapping=aes(x=harv.days, y=harv.mass))+geom_point() ggplot(lettuce, aes(harv.days, harv.mass))+geom_point()+theme_classic() #7 ggplot(lettuce, aes(harv.days, harv.mass, color=leaf.col))+ geom_point()+theme_classic()+ scale_color_manual(values=c("darkgreen", "red"), name="Leaf color")+ labs(x="Harvest days", y="Harvest mass") #8 ggplot(lettuce, aes(harv.days, harv.mass))+ geom_point()+theme_bw()+ labs(x="Harvest days", y="Harvest mass")+ facet_wrap(~leaf.col) #9 ggplot(lettuce, aes(harv.days, harv.mass))+ geom_point(size=3)+theme_bw()+ labs(x="Harvest days", y="Harvest mass")+ facet_wrap(~leaf.col) #10 ?ggsave ggsave("scatter.facettes.png", width=6, height=4, dpi=300) ggsave("scatter.facettes.pdf", width=6, height=4)