Rで複数の系列を異なるタイプでプロットする方法
How to plot multiple series with different types
R言語でヒストグラムとラインプロットを組み合わせる
x <- seq(-2, 2, 0.01) y1 <- pnorm(x) y2 <- pnorm(x, 1, 1) plot(x,y1,type="l",col="red") lines(x,y2,col="green",type="h")
Results
棒グラフプロットと折れ線グラフの組み合わせ
barplotとlinesでプロットを利用する
num <- c(28, 35, 31, 40, 29, 41, 42) days <- c("Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat") df.bar <- barplot(num, main = "Return of Assets", xlab = "Days", ylab = "Return", names.arg= days, col = "gray") lines(x = df.bar, y = num/2,col="red",type="o")