Date: 2006-05-13 11:24:26 -0700 (Sat, 13 May 2006)
add description for minimal graph example
--- trunk/pyx/examples/graphs/minimal.txt (rev 0)
+++ trunk/pyx/examples/graphs/minimal.txt 2006-05-13 18:24:26 UTC (rev 2655)
@@ -0,0 +1,27 @@
+Basic graph drawing: data contained in a file
+This example shows how to draw a graph representing data stored in a file. ...
+The first step is to create an instance of the `graphxy` class which can be
+found in the `graph` module. By convention, we call it `g`. The constructor
+expects at least some information about the desired size of the graph. Here, we
+specify a width of 8 cm.
+! If we only specify one dimension of the graph size, PyX calculates the other
+automatically, assuming a ratio corresponding to the golden ratio.
+Next, we add some data to the yet empty graph. In order to do so, we first
+create a `graph.data.file` instance, which reads the file with the name given
+as the first argument, i.e., in the present case, `"minimal.dat"`. In addition,
+we have to specify, how the data is organized in the file. To this end, we use
+the keyword arguments `x=1` and `y=2`, which tell PyX that the first (second)
+column of the file contains the x (y) values. The `graph.data.file` instance is
+then directly passed to the `plot` method of the graph `g`.
+Finally, we write the graph to an EPS and PDF file. Here, we use that every
+graph is (by inheritance) an instance of the `canvas` class, as well, such that
+we can directly write it into a file.
+! Of course, you can also insert a graph into another canvas and write this
+canvas later to a file. This way, you can, for instance, easily arrange more
+than one graph on a page.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Get latest updates about Open Source Projects, Conferences and News.