Skip to content
A CGI program who creates 3D plots of math functions in SVG, JS canvas and PBM.
Python Other
  1. Python 99.2%
  2. Other 0.8%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

3D plotting of mathematical functions from scratch

I like watching videos on YouTube which describing how 3D on the screen is working. It's a difficult topic, especially when it comes to the math and game programming (with camera positions etc.). I started to play with GNUPlot but I realised that this program is not capable to make a perspective plot. So I started to program a solution in Python. The learning process was huge.


  1. Download all the files
  2. Run
  3. Visit http://localhost:8888
  4. Enjoy

What does the program?

  1. It creates the mesh (lines) of the function
  2. It moves all points to the camera position
  3. After that the rotations take place
  4. Perspective Plot is happening, 3D to 2D with min1,max1
  5. SVG, JS Canvas and a PBM file is created

The PBM file is only created if the programs of the NETPBM package is installed. Otherwise it won't show that picture. I'm sorry for not providing more informations about how the parameters are affecting the plot. But I would not able to, just play with it and read the code. I figured out most of the stuff by myself and don't know how the things are named properly. I don't even know if I did it right.


Pythonstudio Member

You can’t perform that action at this time.