GeoGebra is a graphing calculator software that works on many operating systems and platforms.
$ sudo apt install geogebra
I highly recommend installing the newer 5.x version of GeoGebra by downloading the Debian package from its website. The 5.x version has major improvements including a 3D graphing mode.
2D graphing: Any function of one variable that you type in the input at the bottom is graphed. Older functions can be removed from the list by right-clicking and choosing Delete.
3D graphing: This is available only in 5.x versions of GeoGebra. To get this view choose View -> 3D Graphics. Type any function in two variables x and y in the input and its 3D graph is plotted. To rotate the graph, press and hold down the right mouse button and move the mouse.
Tried with: GeoGebra 5.0.307 and Ubuntu 16.04