A: 

I would just point out this related question. It's a real leap to go from this solution to solving your particular problem, but I'm posting this in case it might help.

With this sample data:

b<-cumsum(rnorm(100))
x<-sample(c(1,2), size=100, replace=TRUE)
t<-1:(length(b))

Here x would represent your values, b is the color (rising/falling), and t is the x-axis. Reformat it with melt:

library(ggplot2)
tmp <- melt(data.frame(cbind(t,b,x)),meas=c("x"))
head(tmp)

And plot it:

ggplot(tmp, aes(x=t,groups=variable)) +
  facet_wrap(~variable) +
  geom_path(aes(y=b,colour=factor(value))) +
  labs(x=NULL)
Shane
Thanks again Shane. It seams that geom_path requires a sorting of the data that would be difficult in my case.
Andreas
+4  A: 

Your merge didn't work because you only had two colour variables, but three data values. Adding a third colour variable as padding seems to do the trick. geom_line takes it's colour from the previous datapoint's value, so the last value of "value2" is not used.

d$farve3<-NA
dm1 <- melt(d[,c("Type","I.alt","idx06","idx07","idx08")], id=c("Type","I.alt"))
dm2 <- melt(d[,c("Type","I.alt","farve1","farve2","farve3")], id=c("Type","I.alt"))
colnames(dm2) <- c("Type", "I.alt", "variable2", "value2")
dm<-cbind(dm1,dm2)
ggplot(dm, aes(x=variable,y=value,group=Type,label=Type,size=I.alt))+
  geom_line(aes(col=value2))+
  geom_text(data=subset(dm, variable=="idx08"),hjust=-0.2, size=2.5)+
  theme_bw()+
  scale_x_discrete(expand=c(0,1))+
  opts(legend.position="none")+
  scale_colour_manual(values=c("green","red"))
Ian Fellows
That worked! Thank you very much, Ian.
Andreas