Creating your first graph

Creating a basic graph in QPlot is just as easy as with Matplotlib. For instance:

import numpy as np

import pyqplot as qp

x = np.arange(-10, 10, 0.1)

qp.plot(x, np.sin(x))

(Type this at the python or ipython command prompt.) A window similar to the one below should appear:

(If that does not happen, something is broken. Did you install numpy? Can python find the pyqplot library? Did you add the qplot binary to your system search path?)

Installation problems out of the way? Let’s save our graph:

qp.save('MyFirstGraph.pdf')

This produces a pdf file; you could also have saved your graph as a bitmap (jpeg, png, etc.) or as vector graphics (svg) just as easily.

This example has hopefully demonstrated that using QPlot is easy enough. But it probably hasn’t yet convinced you that you want to use QPlot. Please hang on, there is more to come.

(C) Daniel Wagenaar, 2019. This web page is licensed under the GNU Free Documentation License.