Skip to content

Instantly share code, notes, and snippets.

@mw55309
Created February 11, 2021 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mw55309/2ace5694af5567ec056a46700f906e08 to your computer and use it in GitHub Desktop.
Save mw55309/2ace5694af5567ec056a46700f906e08 to your computer and use it in GitHub Desktop.
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