Gnuplot is an open source command line graphing utility developed by Philipp K. Janert that allows students, scientists and researchers to create data and math formulas in an interactive manner. This cross platform program can also be used by third party programs and it has some web scripting support too.
With Gnuplot, you can perform complex calculations from the command line even without a calculator. If you’re going to install it on a Mac, you’re going to need Homebrew or MacPorts (and guides are provided for the OS on the official website). Once Gnuplot has been installed, type “gnuplot” at the terminal and hit the enter key.
To start graphing, type “set terminal dumb”, and from there you just enter the mathematical equation and graph away. Just to give you an idea of how it works, you can create a simple cosine function is formulated by typing “plot cos(x+2)” and hitting the enter key.
The “plot” command instructs Gnuplot what has to be done with the equation you typed, and the cos(x+2) is the equation you want to graph. Apart from basic graphs, the program allows you to plot intricate graphs with several curves. Once you’ve created a graph, the image can be outputted to PNG format for sharing, printing or saving.
To output to PNG, name the image and plot afterwards, type:
set term png
set output “graph.png”
set term dumb
You can change “graph.png” to whatever you want to name the file. The file is saved in the same folder that Gnuplot is installed.