2D Function Plotter

Ed Mackey has created a function plotter application, which plots 2D maths functions on to a graph using canvas.

Graph plotting using canvas

The function plotter allows for scrolling, stretching and zooming with the mouse and will automatically rescale the grid lines. There are a variety of preset functions to try, or you can enter your own.


Applications, Graphs
Ed Mackey
Posted on:
January 26th, 2010
Posted by:
Andi Smith



Your Rating:
1 Star2 Stars3 Stars4 Stars5 Stars

Works on

BETA Please let us know if you find 2D Function Plotter works in other browsers by leaving a comment below.



Looking through the source code it looks as though var x is defined in the plot() method and then isnt actually used. how is the scaling being applied to xPos?

Great app though.

Posted on January 26, 2010

Ed Mackey

Shaun, the variable x, which appears unused, is actually the main “x” that’s used by the formulas being evaluated. In other words “x” is being used by the Eval() call in that plot() function (for most formulas). The other ones, xPos and yPos, are the corresponding canvas pixel locations, and their relationship to x and y are determined by the zoom and stretch levels.

Posted on January 28, 2010


I used your code to implement a webOS app for my palm pre. I would like to publish it as a free app in the official app catolg. It goes without saying that I will refer to you and your blog. I hope you agree.

Posted on March 28, 2010

Ed Mackey

Hi Thomas, sure that sounds great! Can you post some screenshots someplace?

Posted on May 3, 2010


works in Opera

Posted on May 12, 2010

Samuel Huang

Nice tool! Please note that

would allow the user to execute plot with the ENTER key (instead of refreshing screen). Also, for security, I think a “white list” of allowed Math.* functions and the variable “x” then then current “black list” implementation.

Posted on May 17, 2010

Wojtek Skulski

Hi, it would be great if you could add IE support using excanvas. Yes, I know I should be switching to Chrome. But meanwhile please add excanvas, which according to the reviews should be adequate for simple plots. Thank you — Wojtek

Posted on February 10, 2011


I like the helpful info you provide in your articles. I will bookmark your
blog and check again here frequently. I’m quite certain I’ll
learn lots of new stuff right here! Best of luck for the

Posted on September 24, 2014

Add comment

(will not be published)