#introducir tabla de datos
z<- structure(list(Intermoult = structure (c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L),.Label = c("Instar1","Instar2","Instar3 ","Instar4","Instar5 ","Instar6","Instar7","Instar8",
"Instar9","Instar10","Instar11","Instar12","Instar13","Instar14" ,"Instar15 ","Instar16"),class = "factor"),
Way = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L , 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L),
.Label = c(" Initial 200 larvae", " 80 larvae transferred from the mass culture"), class = "factor"),
Mean = c(8.4,7.6,9.4,11.3,16.7,10.3,17.3,14.2,13.4,14.4,14.2,16.4,19.0,22.3,27.0,NA,16.7,17.0,18.3,15.0,15.6,15.1,14.7,17.6,21.1,18.8,27.0),
SD = c(0.5,1.3,1.0,1.6,2.4,1.7,4.0,3.5,2.1,4.1,2.5,2.2,3.5,3.9,0.0,NA,5.0,6.7,5.8,4.7,4.0,2.6,2.1,3.2,4.5,1.3,0.0),
upp = c(11,19,13,15,20,15,22,22,17,25,19,20,25,28,27,NA,24,33,30,28,26,20,19,23,30,20,27),
low = c(8,6,8,9,13,9,12,10,11,12,10,13,14,19,27,NA,12,10,11,8,11,11,11,13,16,17,27)) ,
class = "data.frame", ,row.names = c(NA, -27L) )
colnames(z)<- c("Intermoult", "Way", "Mean", "SD", "upper", "lower")
###Crear plot
library(ggplot2)
pdf(file = "intermuda2.pdf", width = 6, height = 6, dpi= 600) #Guardarlo como pdf
p<-ggplot(z,aes(x=Intermoult,y=Mean,ymin=Mean-SD,ymax=Mean+SD,
groups=Way,colour=Way))+
geom_point(position=position_dodge(width=0.5))+
geom_pointrange(width=0.5,position=position_dodge(width=0.5))+
labs(x="Intermoult",y="Intermoult Period (Days)")+ theme_bw()+ opts(legend.position = c(0.18,0.6))+ #colocar la leyenda
scale_colour_manual("", c(" Initial 200 larvae" = "#5CB0E2", " 80 larvae transferred from the mass culture" = "darkblue"))
p + ylim(c(-1, 30))
#Características del plot#########################
last_plot() + opts(panel.grid.minor = theme_line(colour = NA),
panel.grid.major = theme_line(colour = NA),
plot.background = theme_rect(colour = NA, fill = NA),
axis.title.x = theme_text( face = "bold"),
axis.title.y = theme_text( face = "bold", angle = 90),
legend.key = theme_rect ( colour = NA, fill = NA))
dev.off
#colocar graficos en una página (creamos un nuevo grid y seleccionamos la forma)
library(gridExtra)
grid.newpage()
print(grid.arrange(plot1, plot2, plot3,plot4, plot5, nrow=1, ncol=5)) #ponerlos en columnas y filas