Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
x <- 0:100
y <- 100/x
plot(x,y, xlim=c(0,100), ylim=c(0,100), type="l", xlab="health", ylab="wealth", xaxt="n", yaxt="n", bty="n")
#axis(side=1, labels=FALSE, tick=NA, lty=1, lwd=1)
u <- par("usr")
# Use arrows() to draw the axis lines, adding the arrowheads
# Use the par("usr") values to specify the end points of the lines
# Setting 'xpd = TRUE' allows for the arrowhead to be drawn outside
# the plot region as required here
arrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE)
arrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)
x <- x+10
y <- y+10
lines(x,y)
x <- x+10
y <- y+10
lines(x,y)
x <- x+10
y <- y+10
lines(x,y)
x <- x+10
y <- y+10
lines(x,y)
x <- x+10
y <- y+10
lines(x,y)
x <- x+10
y <- y+10
lines(x,y)
text(5,5, "SAD")
text(80,80, "HAPPY")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment