Thanks for you help Slowlearner. I just fixed the code with your commentaries. I could fix the code using melt()
function at the beginning and scale_linetype_maunual
into the code. Here is the new code.
library(reshape)
intactos2 <- melt(intactos, id.var = c("ecd","ACTIVIDAD"))
a <- ggplot(intactos2,aes(y = value, x= ecd,group=ACTIVIDAD))+
geom_line(aes(colour = ACTIVIDAD,linetype=ACTIVIDAD),colour='black',size=0.5)+
scale_linetype_manual("Glaciares rocosos",
breaks=c("1","2"),
values=c("solid","dashed"),
labels = c("Activos", "Inactivos"))+
ylab("Altitud m") +
xlab("Distribucion Acumulada (%)\n")+
scale_y_continuous(limits=c(3500,5000),
breaks=c(3500,3750,4000,4250,4500,4750,5000))+
scale_x_continuous(limits = c(0.00, 1.00),
breaks = seq(0, 1, 0.1),
labels=seq(0,100,10))+
theme( plot.background = element_rect(fill="white")
,panel.background = element_rect(fill='white')
,panel.grid.major = element_line(colour = 'grey', linetype = 'dotted',size=0.5)
,panel.grid.minor = element_line(colour = 'white', linetype = 'dashed')
,panel.border = element_blank()
,axis.line = element_line(colour = 'black')
,axis.text.x=element_text(colour="black")
,axis.text.y=element_text(colour="black")
,panel.grid.major =element_line(colour = 'grey', linetype = 'dashed')
,legend.key=element_rect(fill="white",colour="white"),legend.position=c(0.3,0.8))+
geom_hline(aes(yintercept=4000),linetype="solid",size = 0.5)
a
a + annotate("text",label="0°C MAAT isoterma",x=0.8,y=4050,size=4)
Here the plot that I finally got! https://dl.dropbox.com/u/11320858/plot3.png