Consider the following example:
p <- ggplot(data = data.frame(A=c(1,2,3,4,5,6,7,8),B=c(4,1,2,1,3,2,4,1),C=c(\"A\",\"B\",\"A\",\"B\",\"A\",\"B\",\"A\",\"B\
library(ggplot2) df <- data.frame(A = c(1,2,3,4,5,6,7,8), B = c(4,1,2,1,3,2,4,1), C = c("A","B","A","B","A","B","A","B") ) ggplot(df) + geom_line(aes(x = A, y = B,color = C)) + scale_color_discrete(labels = c(expression(A[t-k]^h), expression(B[t-k]^h)))