Writing a web GUI for gnuplot
This final recipe will teach you how to make your own interactive web application that uses gnuplot to draw a graph in response to user input. It is not a general-purpose GUI for gnuplot as was the subject of the previous recipe, but rather shows one way to use gnuplot as part of a special-purpose web application. Because gnuplot can be controlled through text commands and can create PNG
files, which are size-efficient and well supported by current web browsers, it is very well suited to this type of project.
We are going to create a simple game that asks the user to hit a target with a cannonball. The player enters two numbers, the initial speed of the projectile and the angle of the cannon. After clicking on a button labeled fire!, a graph is displayed showing the trajectory of the cannonball calculated from the two input numbers and plotted by gnuplot. The player can repeatedly enter new numbers and fire, and each time the graph will be replaced. The game...