some updates to the webpage
[PyX.git] / examples / graphs / axis.txt
blob65df2a70182b05a21d0e0b58dd32b9b3780a6265
1 Using a logarithmic axis and defining the axis range
3 Sometimes, you have to visualize rather pathological funtions containing
4 divergencies and/or varying over a large parameter range. This is best done
5 using an appropriate axis. Here, we show a simple example how to do
6 this with PyX. ...
8 In order to change the properties of the graph axes, we have to create
9 appropriate instances of an axis class and pass them as keyword arguments to
10 the `graph.graphxy` constructor. A number of predefined axes is contained in
11 the `graph.axis` module. Here, we use a linear (abbreviated as
12 `graph.axis.lin`) and a logarithmic (abbreviated as `graph.axis.log`) axis. In
13 both cases, we pass a minimal and maximal value for the axis range. Whereas for
14 the x-axis this is not strictly necessary (we could as well tell the
15 `graph.data.function` instance to emit data in a certain x-range), it is
16 important for the y-axis because the function diverges for certain x values. If
17 we do not set the y range manually, we would obtain a rather compressed display
18 of the function in the y-direction, which, moreover, would strongly depend on
19 the sampling points choosen by PyX along the x-direction. Since the function only
20 diverges towards positive y-values, we only need to set the maximal value of
21 the y-axis (using the `max`-argument). Of course, you can also fix the lower end
22 of the axis range by providing a `min`-argument.
24 ! Note how PyX changes the way the x-axis is drawn. Instead of simple decimal
25 numbers, an exponential notation is used. This happens automatically by
26 default, if at least one of the values to be shown becomes 10,000 or bigger
27 smaller than 0.001. This behaviour can be altered by using a different axis
28 texter.