PyX — Examples: Basic plotting

One of PyX's major strengths are its graph-plotting capabilities. PyX offers you a flexible system which, while providing sensible defaults, allows you to customize almost every aspect of the graph output. Such a flexibility comes at a price, though: you need to learn at least a little bit about the different components playing together in order to produce a graph. In this section, we try to give you a gentle introduction to one component after the other by by demonstrating how to plot various kind of data (from a file, a function mapping x values to y values, a parametric function). Furthermore, we explain how to do simple modifications to the axes of the graph and show how to add a graph key.

After having gone through the introductory examples you should be able to freely go through the following sections of the examples, which examples will be devoted to a more detailed explanation of PyX's graph-plotting facilities. In particular, you might want to learn about the customization of the graph axes (see section Graph axes), about further available graph styles (see section Graph styles) and about bar graphs (see section Bar graphs).

Example overview for this section

minimal.png

Plotting data contained in a file

This example shows how to draw a graph representing data stored in a file. more ...

function.png

Plotting a function graph

Here, we explain how to plot the graph of a real-valued mathematical function of a single real parameter. more ...

points.png

Plotting data contained in one or more lists

Here, we explain how to plot data which has been calculated before and which is available in a list. more ...

lissajous.png

Plotting a parametric function

This example shows how to use a paramfunction as a data source for a graph. paramfunction defines a parameter variable name given as a string in the first argument, a minimal and a maximal value given as the second and third argument and an expression string as forth argument. more ...

axis.png

Using a logarithmic axis and defining the axis range and its label

Sometimes, you have to visualize rather pathological funtions containing divergencies and/or varying over a large parameter range. This is best done using an appropriate axis. Here, we show a simple example how to do this with PyX. more ...

change.png

Plotting more than one data set and adding a graph key

In this example we demonstrate how to plot more than one data set in a graph. Furthermore, adding a graph key labelling the data is explained. more ...

join.png

Joing multiple datasets for grouping in the graph key

If you want to group datasets in the graph key, e.g., to compare simulation results with measurement data more ...