KB: Simple Line Chart in R

x=seq(-10,10,0.1)
y2=x^2
y3=x^3

plot(
  x=x,
  y=y2, type="l", ylim=c(-100,100), col="red", ylab="f(x)"
)
lines(x,y3, type="l", ylim=c(-100,100), col="blue")
legend("bottomright",c("f(x)=x^2","f(x)=x^3"), lty=c(1,1), col=c("red","blue"))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s