r - plotting 2 curves; solid lines instead of dotted -
i plot 2 functions in graph.
r <- rnorm(20,0,1) z <- c(1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1) data <- as.data.frame(na.omit(cbind(z, r))) series1 <- ts(cumsum(c(1,data[,2]*data[,1]))) series2 <- ts(cumsum(c(1,data[,2])))
the plot of series2 looks this.
combining 2 curves in 1 graph
matplot(cbind(series1, series2), xaxt = "n", xlab = "time", ylab = "value", col = 1:3, ann = false, type = 'l')
gives this:
the curve of series2 dotted line.
i have 2 questions:
1) how can change dotted line solid line?
2) titles axis not shown in either of graphs. how can fix that?
thanks in advance.
the code below should give desired results:
matplot(cbind(series1, series2), xaxt = "n", xlab = "time", ylab = "value", col = 1:3, ann = true, type = 'l', lty = 1)
the key options are:
ann = true
type = 'l'
Comments
Post a Comment