Skip to content

Instantly share code, notes, and snippets.

@bachmeil
Created May 11, 2021 22:19
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 bachmeil/4b715b5e4505d777ad13f23e16f42a6f to your computer and use it in GitHub Desktop.
Save bachmeil/4b715b5e4505d777ad13f23e16f42a6f to your computer and use it in GitHub Desktop.
Supply and demand graph example in R
plot(-1, ylim=c(0, 12), xlim=c(0, 12), xlab="", ylab="", xaxt='n', yaxt='n', axes=0, main="Supply and Demand")
segments(0, 0, 0, 10, lwd=3)
segments(0, 0, 10, 0, lwd=3)
segments(1, 1, 9, 9, lwd=3)
segments(1, 9, 9, 1, lwd=3)
text(0, 11, "P", cex=1.6)
text(10.5, 0, "Q", cex=1.6)
text(9.3, 9.2, "S", cex=1.4)
text(9.3, 1.2, "D", cex=1.4)
points(5, 5, pch=19, cex=1.5, col="blue")
text(5, 5.9, "E", col="blue", cex=1.4)
symbols(5, 5.4, squares=1, fg="blue", lwd=3, add=TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment