r

an anonymous user · December 06, 2021 · R
#t = 1:50
y = 2.5*sin(t*pi/60)+rnorm(t)
plot(t,y,type="l",main ="Line plot")

lty_val = 1:6
plot(lty_val,axes = FALSE,ann=FALSE,type="n")
abline(h=lty_val,lwd=2,lty=lty_val)
mtext(lty_val,at=lty_val,side=2)
title("Line types(lty)")

plot(t,y,lwd=2,type="l")
abline(h=mean(y),col="red",lty=2)
abline(h=range(y),col="blue",lty=3)
abline(v=t[c(which.min(y),which.max(y))],col="brown",lty=3)
title("Line plot with auxilliary lines")

p=40
plot(t[t<=p],y[t<=p],type="l",
  xlim = range(t),xlab="t",ylab="y")
lines(t[t>=p],y[t>=p],lty=2)
title("Two period Line Plot")

plot(y,type="l")
points(y,pch=16)
title("Line plot with points")

plot(y,pch=16)
lines(y)
title("Line plot with points")

barplot(1:10,names.arg=LETTERS[1:10])

Comments

Please sign up or log in to contribute to the discussion.