From: <joergl@us...>  20060522 20:31:49

Revision: 2783 Author: joergl Date: 20060522 13:31:37 0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/pyx/?rev=2783&view=rev Log Message:  moving around of examples and documentation of linkedaxis example Modified Paths:  trunk/pyx/examples/axis/INDEX trunk/pyx/examples/graphs/INDEX Added Paths:  trunk/pyx/examples/axis/link.py trunk/pyx/examples/axis/piaxis.py Removed Paths:  trunk/pyx/examples/graphs/link.py trunk/pyx/examples/graphs/piaxis.py Modified: trunk/pyx/examples/axis/INDEX ===================================================================  trunk/pyx/examples/axis/INDEX 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/axis/INDEX 20060522 20:31:37 UTC (rev 2783) @@ 1,3 +1,4 @@ +link minimal painter rating @@ 5,3 +6,4 @@ parter texter log +piaxis Copied: trunk/pyx/examples/axis/link.py (from rev 2779, trunk/pyx/examples/graphs/link.py) ===================================================================  trunk/pyx/examples/axis/link.py (rev 0) +++ trunk/pyx/examples/axis/link.py 20060522 20:31:37 UTC (rev 2783) @@ 0,0 +1,14 @@ +import math +from pyx import * + +c = canvas.canvas() + +g1 = c.insert(graph.graphxy(width=8)) +g1.plot(graph.data.function("y(x)=2*exp(30*x)exp(3*x)", min=0, max=1)) + +g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5, + x=graph.axis.linkedaxis(g1.axes["x"]))) +g2.plot(graph.data.function("y(x)=cos(20*x)*exp(2*x)")) + +c.writeEPSfile("link") +c.writePDFfile("link") Copied: trunk/pyx/examples/axis/piaxis.py (from rev 2779, trunk/pyx/examples/graphs/piaxis.py) ===================================================================  trunk/pyx/examples/axis/piaxis.py (rev 0) +++ trunk/pyx/examples/axis/piaxis.py 20060522 20:31:37 UTC (rev 2783) @@ 0,0 +1,17 @@ +from math import pi +from pyx import * +from pyx.graph import axis + +g = graph.graphxy(width=8, key=graph.key.key(pos="bl"), + x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi, + texter=axis.texter.rational(suffix=r"\pi")), + y=axis.linear(title="$y$")) + +g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) +g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$")) + +g.finish() +g.stroke(g.ygridpath(0)) + +g.writeEPSfile("piaxis") +g.writePDFfile("piaxis") Modified: trunk/pyx/examples/graphs/INDEX ===================================================================  trunk/pyx/examples/graphs/INDEX 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/INDEX 20060522 20:31:37 UTC (rev 2783) @@ 3,6 +3,4 @@ lissajous axis change piaxis manyaxes link Deleted: trunk/pyx/examples/graphs/link.py ===================================================================  trunk/pyx/examples/graphs/link.py 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/link.py 20060522 20:31:37 UTC (rev 2783) @@ 1,15 +0,0 @@ import math from pyx import *  c = canvas.canvas()  g1 = c.insert(graph.graphxy(width=8,  x=graph.axis.linear(min=0, max=1))) g1.plot(graph.data.function("y(x)=2*exp(30*x)exp(3*x)"))  g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5,  x=graph.axis.linkedaxis(g1.axes["x"]))) g2.plot(graph.data.function("y(x)=cos(20*x)*exp(2*x)"))  c.writeEPSfile("link") c.writePDFfile("link") Deleted: trunk/pyx/examples/graphs/piaxis.py ===================================================================  trunk/pyx/examples/graphs/piaxis.py 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/piaxis.py 20060522 20:31:37 UTC (rev 2783) @@ 1,17 +0,0 @@ from math import pi from pyx import * from pyx.graph import axis  g = graph.graphxy(width=8, key=graph.key.key(pos="bl"),  x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi,  texter=axis.texter.rational(suffix=r"\pi")),  y=axis.linear(title="$y$"))  g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$"))  g.finish() g.stroke(g.ygridpath(0))  g.writeEPSfile("piaxis") g.writePDFfile("piaxis") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <wobsta@us...>  20060522 19:55:08

Revision: 2780 Author: wobsta Date: 20060522 12:47:35 0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/pyx/?rev=2780&view=rev Log Message:  update the axes examples to the new structure  hopefully its now becoming more useful Modified Paths:  trunk/pyx/examples/axis/INDEX trunk/pyx/examples/axis/README trunk/pyx/examples/axis/log.py trunk/pyx/examples/axis/manualticks.py trunk/pyx/examples/axis/painter.py trunk/pyx/examples/axis/parter.py trunk/pyx/examples/axis/rating.py trunk/pyx/examples/axis/texter.py Added Paths:  trunk/pyx/examples/axis/log.txt trunk/pyx/examples/axis/manualticks.txt trunk/pyx/examples/axis/minimal.py trunk/pyx/examples/axis/minimal.txt trunk/pyx/examples/axis/painter.txt trunk/pyx/examples/axis/parter.txt trunk/pyx/examples/axis/rating.txt trunk/pyx/examples/axis/texter.txt Removed Paths:  trunk/pyx/examples/axis/simple.py Modified: trunk/pyx/examples/axis/INDEX ===================================================================  trunk/pyx/examples/axis/INDEX 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/INDEX 20060522 19:47:35 UTC (rev 2780) @@ 1,4 +1,4 @@ simple +minimal painter rating manualticks Modified: trunk/pyx/examples/axis/README ===================================================================  trunk/pyx/examples/axis/README 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/README 20060522 19:47:35 UTC (rev 2780) @@ 1,5 +1,7 @@ Graph axes This section demonstrates the axis subsystem of the graph module. While here axes are created along paths, all the demonstrated features can be used in graphs as well. +This section demonstrates some axes features of the graph system. For that we +draw axes along paths, although this ''might'' look a bit esoteric (especially +since we're using curved paths). But please be not distracted by that: all the +shown functionality is available to the quite boring case of straight axes as +they are typically used in graphs. Modified: trunk/pyx/examples/axis/log.py ===================================================================  trunk/pyx/examples/axis/log.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/log.py 20060522 19:47:35 UTC (rev 2780) @@ 1,9 +1,3 @@ # Certainly logarithmic axes are supported in PyX. By playing with # partitioners and texters, you can easily change the base. # # It is left as an exercise to the reader to create a automatic # partitioner for logarithmic axes with base 2.  import math from pyx import * from pyx.graph import axis Added: trunk/pyx/examples/axis/log.txt ===================================================================  trunk/pyx/examples/axis/log.txt (rev 0) +++ trunk/pyx/examples/axis/log.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,14 @@ +Logarithmic axes + +Logarithmic axes are quite similar to linear axes and differ only in a very few +properties, namely the nonlinear convert method in which they transform values +to positions on the axis, a different default partitioner and a different +default rater. While the partitioner really is quite different  it implements +a logarithmic positioning of the ticks  the rater just alters some defaults in +favour of using more subticks to improve the visualization of the logarithmic +nature of the axis. + +! Beside presenting a standard logarithmic axis we also show you how to alter +the base used by the logarithmic axis. Since the functionality of a logarithmic +axis is independend of the base, all we need to adjust are certain components +creating ticks, the texts for the labels etc. Property changes on: trunk/pyx/examples/axis/log.txt ___________________________________________________________________ Name: svn:eolstyle + native Modified: trunk/pyx/examples/axis/manualticks.py ===================================================================  trunk/pyx/examples/axis/manualticks.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/manualticks.py 20060522 19:47:35 UTC (rev 2780) @@ 1,19 +1,14 @@ # Ticks can be set manually in combination with automatically created # ticks. Note that the rating takes into account the manual ticks as # well.  import math from pyx import * from pyx.graph import axis p = path.curve(0, 0, 3, 0, 1, 4, 4, 4) myticks = [axis.tick.tick(math.pi, label="\pi", labelattrs=[text.mathmode]),  axis.tick.tick(2*math.pi, label="2\pi", labelattrs=[text.mathmode])] +myticks = [graph.axis.tick.tick(math.pi, label="\pi", labelattrs=[text.mathmode]), + graph.axis.tick.tick(2*math.pi, label="2\pi", labelattrs=[text.mathmode])] c = canvas.canvas() c.insert(axis.pathaxis(p, axis.linear(min=0, max=10))) c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0)),  axis.linear(min=0, max=10, manualticks=myticks))) +c.insert(graph.axis.pathaxis(p, graph.axis.linear(min=0, max=10))) +c.insert(graph.axis.pathaxis(p.transformed(trafo.translate(4, 0)), + graph.axis.linear(min=0, max=10, manualticks=myticks))) c.writeEPSfile("manualticks") c.writePDFfile("manualticks") Added: trunk/pyx/examples/axis/manualticks.txt ===================================================================  trunk/pyx/examples/axis/manualticks.txt (rev 0) +++ trunk/pyx/examples/axis/manualticks.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,11 @@ +Manually place ticks at certain positions + +Ticks can be set manually by passing tick instances to the `manualticks` +argument of the axis instance as shown at the right axis in this example. + +As you can see the manual ticks are combined with tick created automatically. +You could disable any automatic tick creation by setting the `parter` argument +to None. But what's much more interesting is, that the manually and +automatically created ticks are not just merged, but the combination together +is used when rating the resulting partion. Hence the manual ticks lead to a +different set of automatically created ticks for this example. Property changes on: trunk/pyx/examples/axis/manualticks.txt ___________________________________________________________________ Name: svn:eolstyle + native Copied: trunk/pyx/examples/axis/minimal.py (from rev 2776, trunk/pyx/examples/axis/simple.py) ===================================================================  trunk/pyx/examples/axis/minimal.py (rev 0) +++ trunk/pyx/examples/axis/minimal.py 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,6 @@ +from pyx import * + +c = graph.axis.pathaxis(path.curve(0, 0, 3, 0, 1, 4, 4, 4), + graph.axis.linear(min=0, max=10)) +c.writeEPSfile("minimal") +c.writePDFfile("minimal") Added: trunk/pyx/examples/axis/minimal.txt ===================================================================  trunk/pyx/examples/axis/minimal.txt (rev 0) +++ trunk/pyx/examples/axis/minimal.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,13 @@ +Minimal example drawing an axis along a path + +This is the basic example how to draw an axis along an arbitrary path. The +function `pathaxis` from the `graph.axis` module takes a path and returns a +canvas. Different from the typical usecase in graphs, we must fix the axis +range by appropriate `min` and `max` arguments, because no data is provided to +the axis instance where a data range could be extracted from. In graphs the +range of an axis gets adjusted automatically although you can still set minimal +and/or maximal values to force a certain axis range. + +The axis instance is passed as the second argument to the `pathaxis` function. +To use the axis at a graph all you need to do is to path the instance to the +axis constructor using an appropriate keyword specifying the axis name. Property changes on: trunk/pyx/examples/axis/minimal.txt ___________________________________________________________________ Name: svn:eolstyle + native Modified: trunk/pyx/examples/axis/painter.py ===================================================================  trunk/pyx/examples/axis/painter.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/painter.py 20060522 19:47:35 UTC (rev 2780) @@ 1,18 +1,8 @@ # Axis painters performs the painting of an axis. By default, ticks # are stroked inside of the graph (in the path examples there is no # graph but don't mind) while labels and the axis title are plotted # outside. The axis title is rotated along the axis (without writing it # upside down), while the tick labels are not rotated. The axis painters # takes a variety of keyword arguments to modify the default # behaviour.  from pyx import * from pyx.graph import axis ap = axis.painter.regular(outerticklength=axis.painter.ticklength.normal) +mypainter = graph.axis.painter.regular(outerticklength=graph.axis.painter.ticklength.normal) c = axis.pathaxis(path.curve(0, 0, 3, 0, 1, 4, 4, 4),  axis.linear(min=0, max=10, title="axis title",  painter=ap)) +c = graph.axis.pathaxis(path.curve(0, 0, 3, 0, 1, 4, 4, 4), + graph.axis.linear(min=0, max=10, title="axis title", painter=mypainter)) c.writeEPSfile("painter") c.writePDFfile("painter") Added: trunk/pyx/examples/axis/painter.txt ===================================================================  trunk/pyx/examples/axis/painter.txt (rev 0) +++ trunk/pyx/examples/axis/painter.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,17 @@ +Painting of an axis + +Axis painters performs the painting of an axis, which means they take all the +information of the axis an create a proper drawing for that. + +While an usual axis painter has quite some parameters to adjust the output, +here we only alter the ticks. By default, ticks are stroked only towards the +inside of the graph (in the path examples there is no graph but don't mind). +The labels and the axis title are plotted outside of the graph. Futhermore the +axis title (when present as in this example) is rotated along the axis (without +writing it upside down), while the tick labels are not rotated at all. + +In this example we set an `outerticklength`. Together with the +`innerticklength` set to the same value by default the ticks are stroked across +the axis. As it is common to subcomponents of the axis, you need to pass the +adapted instances (stored in the variable `mypainter` here) to the axis in its +constructor. Property changes on: trunk/pyx/examples/axis/painter.txt ___________________________________________________________________ Name: svn:eolstyle + native Modified: trunk/pyx/examples/axis/parter.py ===================================================================  trunk/pyx/examples/axis/parter.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/parter.py 20060522 19:47:35 UTC (rev 2780) @@ 1,25 +1,14 @@ # Partitioners (in the code the short form parter is used) take # care of calculating appropriate tick positions for a given axis # range. Automatic partitioners create several tick lists, which are # rated by an axis rater instance afterwards while manual partitioners # create a single tick list only, which thus doesn't need to be rated. # # Note that the partitioning uses fractional number arithmetics. For # that, tick instances can be initialized with floats using a fixed # precision but also with strings as shown.  import math from pyx import * from pyx.graph import axis p = path.curve(0, 0, 3, 0, 1, 4, 4, 4) myparter = axis.parter.linear(["1/3", "1/6"]) +myparter = graph.axis.parter.linear(["1/3", "1/6"]) c = canvas.canvas() c.insert(axis.pathaxis(p, axis.linear(min=0, max=1, parter=myparter))) c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0)),  axis.linear(min=0, max=1, parter=myparter,  texter=axis.texter.rational()))) +c.insert(graph.axis.pathaxis(p, graph.axis.linear(min=0, max=1, parter=myparter))) +c.insert(graph.axis.pathaxis(p.transformed(trafo.translate(4, 0)), + graph.axis.linear(min=0, max=1, parter=myparter, + texter=graph.axis.texter.rational()))) c.writeEPSfile("parter") c.writePDFfile("parter") Added: trunk/pyx/examples/axis/parter.txt ===================================================================  trunk/pyx/examples/axis/parter.txt (rev 0) +++ trunk/pyx/examples/axis/parter.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,21 @@ +Manual parters and rational number arithmetics + +Partitioners (in the code the short form `parter` is used all over the place) +take care of calculating appropriate tick positions for a given axis range. +Automatic partitioners create several tick lists, which are than rated by an +axis rater instance afterwards. In contrast manual partitioners create a single +tick list only, which thus doesn't need to be rated at all. + +In this example we create a manual partitioner, which places ticks with a +distance of 1/3 and subticks with a distance of 1/6. We than use this +partitioner at two axis, which are identical except for a texter instance to +show you another feature of the axes in PyX, namely the rational number +arithmetics used to place ticks. The rational numbers are preserved throughout +the whole process of merging ticks, until the texter finally needs to output +the rational numbers. And at the very end the decimal texter steps into the +problem to create a proper representation for the frations. The solution is +shown at the left part of the example: the texter marks a period to express the +fraction. + +Alternatively you can use the rational texter to display the values by +fractions directly. Property changes on: trunk/pyx/examples/axis/parter.txt ___________________________________________________________________ Name: svn:eolstyle + native Modified: trunk/pyx/examples/axis/rating.py ===================================================================  trunk/pyx/examples/axis/rating.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/rating.py 20060522 19:47:35 UTC (rev 2780) @@ 1,26 +1,14 @@ # In the example below, several axes with the same parameters are # plotted on a path scaled in 3 different sizes. Note that the axes # adjust the ticks appropriately to the available space. The rating # mechanism takes into account the number of ticks and subticks, but # also the distances between the labels. Thus, the example in the # middle has less ticks than the smallest version, because there is # not enough room for labels with a decimal place. # # The rating mechanism is configurable and exchangeable by the axis # keyword argument "rater". Instead of reconfiguring the rating # mechanism, simple adjustments to favour more or less ticks are # possible by the axis keyword argument "density".  from pyx import * from pyx.graph import axis p = path.curve(0, 0, 3, 0, 1, 4, 4, 4) +p2 = path.curve(0, 0, 3, 0, 1, 4, 4, 4) +p1 = p2.transformed(trafo.translate(4, 0).scaled(0.75)) +p3 = p2.transformed(trafo.scale(1.25).translated(4, 0)) +myaxis = graph.axis.linear(min=0, max=10) + c = canvas.canvas() c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0).scaled(0.75)),  axis.linear(min=0, max=10))) c.insert(axis.pathaxis(p, axis.linear(min=0, max=10))) c.insert(axis.pathaxis(p.transformed(trafo.scale(1.25).translated(4, 0)),  axis.linear(min=0, max=10))) +c.insert(graph.axis.pathaxis(p1, myaxis)) +c.insert(graph.axis.pathaxis(p2, myaxis)) +c.insert(graph.axis.pathaxis(p3, myaxis)) c.writeEPSfile("rating") c.writePDFfile("rating") Added: trunk/pyx/examples/axis/rating.txt ===================================================================  trunk/pyx/examples/axis/rating.txt (rev 0) +++ trunk/pyx/examples/axis/rating.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,31 @@ +Rating of axis partitionings + +In this example several axes with the same parameters are plotted on a path +scaled at 3 different sizes. Note that the axes adjust the ticks appropriately +to the available space. For that a `partitioner` (the short form `parter` is +used in the code) creates several possible solutions for placing ticks and +labels at the axis. + +However, we do not address this partioning feature here (we just use the +default), but we show you the rating facilities instead. Still, we don't modify +the defaults either, but we want to discuss certain features of this system. + +The rating mechanism takes into account the number of ticks and subticks, but +also the distances between the labels. Thus, the example in the middle has less +ticks than the right version, because there is more space available at the +larger path. More interestingly more labels are also shown on the very left +path, although it is smaller than the middle one. This is due to the fact, that +there is not enough room for labels with a decimal place on the smaller axis! + +! The rating mechanism is configurable and exchangeable by passing rater +instances to the `rater` keyword of the axis constructor. But instead of +reconfiguring the whole rating mechanism, simple adjustments to favour more or +less ticks are easily possible by the axis keyword argument `density`. + +!! In this example the same axis instance is used several times. This works +since the axis does not store any data within its own instance. Instead, an +`anchoredaxis` instance is created by the `pathaxis` which embbeds the axis in +a proper environment. Among others a place for storing information for this +specific use of the axis instance is provided that way. When using axes in a +graph the graph instance takes care of the proper setup of the anchored axes +instances. Property changes on: trunk/pyx/examples/axis/rating.txt ___________________________________________________________________ Name: svn:eolstyle + native Deleted: trunk/pyx/examples/axis/simple.py ===================================================================  trunk/pyx/examples/axis/simple.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/simple.py 20060522 19:47:35 UTC (rev 2780) @@ 1,13 +0,0 @@ # This is the basic example how to draw an axis along an arbitrary # path. The function pathaxis from the graph.axis module takes a path # and returns a canvas. Different from the typical usecase in graphs, # we must fix the axis range by appropriate min and max arguments, # because of missing data. In graphs the range can be adjusted # automatically.  from pyx import *  c = graph.axis.pathaxis(path.curve(0, 0, 3, 0, 1, 4, 4, 4),  graph.axis.linear(min=0, max=10)) c.writeEPSfile("simple") c.writePDFfile("simple") Modified: trunk/pyx/examples/axis/texter.py ===================================================================  trunk/pyx/examples/axis/texter.py 20060522 17:05:20 UTC (rev 2779) +++ trunk/pyx/examples/axis/texter.py 20060522 19:47:35 UTC (rev 2780) @@ 1,14 +1,3 @@ # Texters create the label strings written to the ticks. There are # texters available for decimal numbers without and with an # exponential part as well as fractions. Internally, the partitioning # is based on fractions to avoid any rounding problems. # # Although we could modify axis.linear into a piaxis "inplace", we # define a special piaxis below to give an impression, how easy # alternative default settings can be implemented. A more advanced # task would be to add an appropriate special partitioner for a # piaxis.  import math from pyx import * from pyx.graph import axis Added: trunk/pyx/examples/axis/texter.txt ===================================================================  trunk/pyx/examples/axis/texter.txt (rev 0) +++ trunk/pyx/examples/axis/texter.txt 20060522 19:47:35 UTC (rev 2780) @@ 0,0 +1,11 @@ +Texter + +Texters create the label strings written to the ticks. There are texters +available for decimal numbers without and with an exponential part as well as +fractions. + +! At the right axis we also show how to create a special piaxis. Here some axis +parameters are altered to fit an piscaled axis nicely. Futhermore instead of +just creating a special axis instance by setting the divisor and texter +parameters, a `piaxis` class is created which just alters the defaults of the +linear axis it is based at. Property changes on: trunk/pyx/examples/axis/texter.txt ___________________________________________________________________ Name: svn:eolstyle + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <joergl@us...>  20060522 20:31:49

Revision: 2783 Author: joergl Date: 20060522 13:31:37 0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/pyx/?rev=2783&view=rev Log Message:  moving around of examples and documentation of linkedaxis example Modified Paths:  trunk/pyx/examples/axis/INDEX trunk/pyx/examples/graphs/INDEX Added Paths:  trunk/pyx/examples/axis/link.py trunk/pyx/examples/axis/piaxis.py Removed Paths:  trunk/pyx/examples/graphs/link.py trunk/pyx/examples/graphs/piaxis.py Modified: trunk/pyx/examples/axis/INDEX ===================================================================  trunk/pyx/examples/axis/INDEX 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/axis/INDEX 20060522 20:31:37 UTC (rev 2783) @@ 1,3 +1,4 @@ +link minimal painter rating @@ 5,3 +6,4 @@ parter texter log +piaxis Copied: trunk/pyx/examples/axis/link.py (from rev 2779, trunk/pyx/examples/graphs/link.py) ===================================================================  trunk/pyx/examples/axis/link.py (rev 0) +++ trunk/pyx/examples/axis/link.py 20060522 20:31:37 UTC (rev 2783) @@ 0,0 +1,14 @@ +import math +from pyx import * + +c = canvas.canvas() + +g1 = c.insert(graph.graphxy(width=8)) +g1.plot(graph.data.function("y(x)=2*exp(30*x)exp(3*x)", min=0, max=1)) + +g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5, + x=graph.axis.linkedaxis(g1.axes["x"]))) +g2.plot(graph.data.function("y(x)=cos(20*x)*exp(2*x)")) + +c.writeEPSfile("link") +c.writePDFfile("link") Copied: trunk/pyx/examples/axis/piaxis.py (from rev 2779, trunk/pyx/examples/graphs/piaxis.py) ===================================================================  trunk/pyx/examples/axis/piaxis.py (rev 0) +++ trunk/pyx/examples/axis/piaxis.py 20060522 20:31:37 UTC (rev 2783) @@ 0,0 +1,17 @@ +from math import pi +from pyx import * +from pyx.graph import axis + +g = graph.graphxy(width=8, key=graph.key.key(pos="bl"), + x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi, + texter=axis.texter.rational(suffix=r"\pi")), + y=axis.linear(title="$y$")) + +g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) +g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$")) + +g.finish() +g.stroke(g.ygridpath(0)) + +g.writeEPSfile("piaxis") +g.writePDFfile("piaxis") Modified: trunk/pyx/examples/graphs/INDEX ===================================================================  trunk/pyx/examples/graphs/INDEX 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/INDEX 20060522 20:31:37 UTC (rev 2783) @@ 3,6 +3,4 @@ lissajous axis change piaxis manyaxes link Deleted: trunk/pyx/examples/graphs/link.py ===================================================================  trunk/pyx/examples/graphs/link.py 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/link.py 20060522 20:31:37 UTC (rev 2783) @@ 1,15 +0,0 @@ import math from pyx import *  c = canvas.canvas()  g1 = c.insert(graph.graphxy(width=8,  x=graph.axis.linear(min=0, max=1))) g1.plot(graph.data.function("y(x)=2*exp(30*x)exp(3*x)"))  g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5,  x=graph.axis.linkedaxis(g1.axes["x"]))) g2.plot(graph.data.function("y(x)=cos(20*x)*exp(2*x)"))  c.writeEPSfile("link") c.writePDFfile("link") Deleted: trunk/pyx/examples/graphs/piaxis.py ===================================================================  trunk/pyx/examples/graphs/piaxis.py 20060522 20:30:51 UTC (rev 2782) +++ trunk/pyx/examples/graphs/piaxis.py 20060522 20:31:37 UTC (rev 2783) @@ 1,17 +0,0 @@ from math import pi from pyx import * from pyx.graph import axis  g = graph.graphxy(width=8, key=graph.key.key(pos="bl"),  x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi,  texter=axis.texter.rational(suffix=r"\pi")),  y=axis.linear(title="$y$"))  g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$"))  g.finish() g.stroke(g.ygridpath(0))  g.writeEPSfile("piaxis") g.writePDFfile("piaxis") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <joergl@us...>  20060522 21:30:10

Revision: 2791 Author: joergl Date: 20060522 14:29:53 0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/pyx/?rev=2791&view=rev Log Message:  move piaxis to gallery Modified Paths:  trunk/pyx/examples/axis/INDEX trunk/pyx/gallery/graphs/INDEX Added Paths:  trunk/pyx/gallery/graphs/piaxis.py Removed Paths:  trunk/pyx/examples/axis/piaxis.py Modified: trunk/pyx/examples/axis/INDEX ===================================================================  trunk/pyx/examples/axis/INDEX 20060522 20:52:43 UTC (rev 2790) +++ trunk/pyx/examples/axis/INDEX 20060522 21:29:53 UTC (rev 2791) @@ 6,4 +6,3 @@ parter texter log piaxis Deleted: trunk/pyx/examples/axis/piaxis.py ===================================================================  trunk/pyx/examples/axis/piaxis.py 20060522 20:52:43 UTC (rev 2790) +++ trunk/pyx/examples/axis/piaxis.py 20060522 21:29:53 UTC (rev 2791) @@ 1,17 +0,0 @@ from math import pi from pyx import * from pyx.graph import axis  g = graph.graphxy(width=8, key=graph.key.key(pos="bl"),  x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi,  texter=axis.texter.rational(suffix=r"\pi")),  y=axis.linear(title="$y$"))  g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$"))  g.finish() g.stroke(g.ygridpath(0))  g.writeEPSfile("piaxis") g.writePDFfile("piaxis") Modified: trunk/pyx/gallery/graphs/INDEX ===================================================================  trunk/pyx/gallery/graphs/INDEX 20060522 20:52:43 UTC (rev 2790) +++ trunk/pyx/gallery/graphs/INDEX 20060522 21:29:53 UTC (rev 2791) @@ 3,6 +3,7 @@ mandel arrows shift +piaxis manyaxes integral partialfill Copied: trunk/pyx/gallery/graphs/piaxis.py (from rev 2788, trunk/pyx/examples/axis/piaxis.py) ===================================================================  trunk/pyx/gallery/graphs/piaxis.py (rev 0) +++ trunk/pyx/gallery/graphs/piaxis.py 20060522 21:29:53 UTC (rev 2791) @@ 0,0 +1,17 @@ +from math import pi +from pyx import * +from pyx.graph import axis + +g = graph.graphxy(width=8, key=graph.key.key(pos="bl"), + x=axis.linear(min=0, max=2*pi, title="$x$", divisor=pi, + texter=axis.texter.rational(suffix=r"\pi")), + y=axis.linear(title="$y$")) + +g.plot(graph.data.function("y(x)=sin(x)", title=r"$\sin(x)$")) +g.plot(graph.data.function("y(x)=cos(x)", title=r"$\cos(x)$")) + +g.finish() +g.stroke(g.ygridpath(0)) + +g.writeEPSfile("piaxis") +g.writePDFfile("piaxis") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <joergl@us...>  20060522 21:34:12

Revision: 2792 Author: joergl Date: 20060522 14:33:55 0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/pyx/?rev=2792&view=rev Log Message:  add ... Modified Paths:  trunk/pyx/examples/axis/log.txt trunk/pyx/examples/axis/manualticks.txt trunk/pyx/examples/axis/minimal.txt trunk/pyx/examples/axis/painter.txt trunk/pyx/examples/axis/parter.txt trunk/pyx/examples/axis/rating.txt trunk/pyx/examples/axis/texter.txt Modified: trunk/pyx/examples/axis/log.txt ===================================================================  trunk/pyx/examples/axis/log.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/log.txt 20060522 21:33:55 UTC (rev 2792) @@ 3,7 +3,7 @@ Logarithmic axes are quite similar to linear axes and differ only in a very few properties, namely the nonlinear convert method in which they transform values to positions on the axis, a different default partitioner and a different default rater. While the partitioner really is quite different  it implements +default rater. ... While the partitioner really is quite different  it implements a logarithmic positioning of the ticks  the rater just alters some defaults in favour of using more subticks to improve the visualization of the logarithmic nature of the axis. Modified: trunk/pyx/examples/axis/manualticks.txt ===================================================================  trunk/pyx/examples/axis/manualticks.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/manualticks.txt 20060522 21:33:55 UTC (rev 2792) @@ 1,7 +1,7 @@ Manually place ticks at certain positions Ticks can be set manually by passing tick instances to the `manualticks` argument of the axis instance as shown at the right axis in this example. +argument of the axis instance as shown at the right axis in this example. ... As you can see the manual ticks are combined with tick created automatically. You could disable any automatic tick creation by setting the `parter` argument Modified: trunk/pyx/examples/axis/minimal.txt ===================================================================  trunk/pyx/examples/axis/minimal.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/minimal.txt 20060522 21:33:55 UTC (rev 2792) @@ 2,7 +2,7 @@ This is the basic example how to draw an axis along an arbitrary path. The function `pathaxis` from the `graph.axis` module takes a path and returns a canvas. Different from the typical usecase in graphs, we must fix the axis +canvas. ... As opposed to the typical usecase in graphs, we must fix the axis range by appropriate `min` and `max` arguments, because no data is provided to the axis instance where a data range could be extracted from. In graphs the range of an axis gets adjusted automatically although you can still set minimal Modified: trunk/pyx/examples/axis/painter.txt ===================================================================  trunk/pyx/examples/axis/painter.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/painter.txt 20060522 21:33:55 UTC (rev 2792) @@ 1,7 +1,7 @@ Painting of an axis Axis painters performs the painting of an axis, which means they take all the information of the axis an create a proper drawing for that. +information of the axis an create a proper drawing for that. ... While an usual axis painter has quite some parameters to adjust the output, here we only alter the ticks. By default, ticks are stroked only towards the Modified: trunk/pyx/examples/axis/parter.txt ===================================================================  trunk/pyx/examples/axis/parter.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/parter.txt 20060522 21:33:55 UTC (rev 2792) @@ 4,7 +4,7 @@ take care of calculating appropriate tick positions for a given axis range. Automatic partitioners create several tick lists, which are than rated by an axis rater instance afterwards. In contrast manual partitioners create a single tick list only, which thus doesn't need to be rated at all. +tick list only, which thus doesn't need to be rated at all. ... In this example we create a manual partitioner, which places ticks with a distance of 1/3 and subticks with a distance of 1/6. We than use this Modified: trunk/pyx/examples/axis/rating.txt ===================================================================  trunk/pyx/examples/axis/rating.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/rating.txt 20060522 21:33:55 UTC (rev 2792) @@ 4,7 +4,7 @@ scaled at 3 different sizes. Note that the axes adjust the ticks appropriately to the available space. For that a `partitioner` (the short form `parter` is used in the code) creates several possible solutions for placing ticks and labels at the axis. +labels at the axis. ... However, we do not address this partioning feature here (we just use the default), but we show you the rating facilities instead. Still, we don't modify Modified: trunk/pyx/examples/axis/texter.txt ===================================================================  trunk/pyx/examples/axis/texter.txt 20060522 21:29:53 UTC (rev 2791) +++ trunk/pyx/examples/axis/texter.txt 20060522 21:33:55 UTC (rev 2792) @@ 2,7 +2,7 @@ Texters create the label strings written to the ticks. There are texters available for decimal numbers without and with an exponential part as well as fractions. +fractions. ... ! At the right axis we also show how to create a special piaxis. Here some axis parameters are altered to fit an piscaled axis nicely. Futhermore instead of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <mschindler@us...>  20080326 15:36:32

Revision: 2977 http://pyx.svn.sourceforge.net/pyx/?rev=2977&view=rev Author: mschindler Date: 20080326 08:36:37 0700 (Wed, 26 Mar 2008) Log Message:  reworked the axis examples to make the descriptions more accessible Modified Paths:  trunk/pyx/examples/axis/INDEX trunk/pyx/examples/axis/link.txt trunk/pyx/examples/axis/log.py trunk/pyx/examples/axis/log.txt trunk/pyx/examples/axis/manualticks.py trunk/pyx/examples/axis/manualticks.txt trunk/pyx/examples/axis/minimal.txt trunk/pyx/examples/axis/painter.py trunk/pyx/examples/axis/painter.txt trunk/pyx/examples/axis/parter.txt trunk/pyx/examples/axis/rating.txt trunk/pyx/examples/axis/texter.py trunk/pyx/examples/axis/texter.txt Modified: trunk/pyx/examples/axis/INDEX ===================================================================  trunk/pyx/examples/axis/INDEX 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/INDEX 20080326 15:36:37 UTC (rev 2977) @@ 1,8 +1,8 @@ +log link minimal painter +texter +manualticks rating manualticks parter texter log Modified: trunk/pyx/examples/axis/link.txt ===================================================================  trunk/pyx/examples/axis/link.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/link.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,4 +1,4 @@ Linking an axis to another one +Linking one axis to another one When plotting two or more related graphs, you sometimes want to have identical axes. This example demonstrates how to achieve this goal in PyX using a Modified: trunk/pyx/examples/axis/log.py ===================================================================  trunk/pyx/examples/axis/log.py 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/log.py 20080326 15:36:37 UTC (rev 2977) @@ 2,19 +2,16 @@ from pyx import * from pyx.graph import axis p = path.curve(0, 0, 3, 0, 1, 4, 4, 4)  +# we here use parters and texters which are explained in the examples below log2parter = axis.parter.log([axis.parter.preexp([axis.tick.rational(1)], 4), axis.parter.preexp([axis.tick.rational(1)], 2)]) log2texter = axis.texter.exponential(nomantissaexp=r"{2^{%s}}", mantissamax=axis.tick.rational(2)) c = canvas.canvas() c.insert(axis.pathaxis(p, axis.log(min=1, max=1024))) c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0)),  axis.log(min=1, max=1024, parter=log2parter))) c.insert(axis.pathaxis(p.transformed(trafo.translate(8, 0)),  axis.log(min=1, max=1024, parter=log2parter,  texter=log2texter))) c.writeEPSfile("log") c.writePDFfile("log") +g = graph.graphxy(width=10, + x=axis.log(min=1, max=1024), + y=axis.log(min=1, max=1024, parter=log2parter), + y2=axis.log(min=1, max=1024, parter=log2parter, texter=log2texter)) + +g.writeEPSfile("log") +g.writePDFfile("log") Modified: trunk/pyx/examples/axis/log.txt ===================================================================  trunk/pyx/examples/axis/log.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/log.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,12 +1,11 @@ Logarithmic axes Logarithmic axes are quite similar to linear axes and differ only in a very few properties, namely the nonlinear convert method in which they transform values to positions on the axis, a different default partitioner and a different default rater. ... While the partitioner really is quite different  it implements a logarithmic positioning of the ticks  the rater just alters some defaults in favour of using more subticks to improve the visualization of the logarithmic nature of the axis. +properties, namely a nonlinear mapping of values to axis positions. They also +have different default partitioners and raters (see below). ... While the +partitioner really is quite different  it implements a logarithmic positioning +of the ticks  the rater just alters some defaults in favour of using more +subticks to improve the visualization of the logarithmic nature of the axis. ! Beside presenting a standard logarithmic axis we also show you how to alter the base used by the logarithmic axis. Since the functionality of a logarithmic Modified: trunk/pyx/examples/axis/manualticks.py ===================================================================  trunk/pyx/examples/axis/manualticks.py 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/manualticks.py 20080326 15:36:37 UTC (rev 2977) @@ 1,14 +1,14 @@ import math from pyx import * p = path.curve(0, 0, 3, 0, 1, 4, 4, 4) +p1 = path.curve(0, 0, 3, 0, 1, 4, 4, 4) +p2 = p1.transformed(trafo.translate(4, 0)) myticks = [graph.axis.tick.tick(math.pi, label="\pi", labelattrs=[text.mathmode]), graph.axis.tick.tick(2*math.pi, label="2\pi", labelattrs=[text.mathmode])] c = canvas.canvas() c.insert(graph.axis.pathaxis(p, graph.axis.linear(min=0, max=10))) c.insert(graph.axis.pathaxis(p.transformed(trafo.translate(4, 0)),  graph.axis.linear(min=0, max=10, manualticks=myticks))) +c.insert(graph.axis.pathaxis(p1, graph.axis.linear(min=0, max=10))) +c.insert(graph.axis.pathaxis(p2, graph.axis.linear(min=0, max=10, manualticks=myticks))) c.writeEPSfile("manualticks") c.writePDFfile("manualticks") Modified: trunk/pyx/examples/axis/manualticks.txt ===================================================================  trunk/pyx/examples/axis/manualticks.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/manualticks.txt 20080326 15:36:37 UTC (rev 2977) @@ 3,9 +3,9 @@ Ticks can be set manually by passing tick instances to the `manualticks` argument of the axis instance as shown at the right axis in this example. ... As you can see the manual ticks are combined with tick created automatically. You could disable any automatic tick creation by setting the `parter` argument to None. But what's much more interesting is, that the manually and automatically created ticks are not just merged, but the combination together is used when rating the resulting partion. Hence the manual ticks lead to a different set of automatically created ticks for this example. +As you can see, the manual ticks are combined with the automatically created +ticks. You could disable any automatic tick creation by setting the `parter` +argument to None. But what's much more interesting is, that the manually and +automatically created ticks are not just merged, but their combination is used +for rating the resulting partition. Therefore, the additional manual ticks lead +to a different set of automatically created ticks in this example. Modified: trunk/pyx/examples/axis/minimal.txt ===================================================================  trunk/pyx/examples/axis/minimal.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/minimal.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,13 +1,12 @@ Minimal example drawing an axis along a path +Minimal example for drawing an isolated axis This is the basic example how to draw an axis along an arbitrary path. The function `pathaxis` from the `graph.axis` module takes a path and returns a canvas. ... As opposed to the typical usecase in graphs, we must fix the axis range by appropriate `min` and `max` arguments, because no data is provided to the axis instance where a data range could be extracted from. In graphs the range of an axis gets adjusted automatically although you can still set minimal and/or maximal values to force a certain axis range. +This is the basic example of how to draw an axis alone  without the whole +graph. It serves to simplify the following examples. ... The function +`pathaxis` from the `graph.axis` module takes a path and returns a canvas which +contains the drawn axis. The axis instance is passed as the second argument to the `pathaxis` function. To use the axis at a graph all you need to do is to path the instance to the axis constructor using an appropriate keyword specifying the axis name. +Differently than in the typical usecase of graphs containing data, we must here +provide the range explicitly (`min` and `max` arguments). graphs the range of +an axis gets adjusted automatically although you can still set minimal and/or +maximal values to force a certain axis range. + Modified: trunk/pyx/examples/axis/painter.py ===================================================================  trunk/pyx/examples/axis/painter.py 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/painter.py 20080326 15:36:37 UTC (rev 2977) @@ 1,8 +1,9 @@ from pyx import * mypainter = graph.axis.painter.regular(outerticklength=graph.axis.painter.ticklength.normal) +mypainter = graph.axis.painter.regular(outerticklength=graph.axis.painter.ticklength.normal, + basepathattrs=[style.linewidth.THick, deco.earrow.large]) c = graph.axis.pathaxis(path.curve(0, 0, 3, 0, 1, 4, 4, 4),  graph.axis.linear(min=0, max=10, title="axis title", painter=mypainter)) + graph.axis.linear(min=0, max=9, title="axis title", painter=mypainter)) c.writeEPSfile("painter") c.writePDFfile("painter") Modified: trunk/pyx/examples/axis/painter.txt ===================================================================  trunk/pyx/examples/axis/painter.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/painter.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,17 +1,20 @@ Painting of an axis +Painter: Controlling the visual features of an axis Axis painters performs the painting of an axis, which means they take all the information of the axis an create a proper drawing for that. ... +The visual features of an axis (such as ticklengths, linewidths, distances of +the labels, their orientation, text attributes, etc.) are controlled by its +painter. You can modify these attributes by creating a painter explicitly. ... While an usual axis painter has quite some parameters to adjust the output, here we only alter the ticks. By default, ticks are stroked only towards the inside of the graph (in the path examples there is no graph but don't mind). The labels and the axis title are plotted outside of the graph. Futhermore the axis title (when present as in this example) is rotated along the axis (without writing it upside down), while the tick labels are not rotated at all. +While the axis painter has quite some parameters to adjust the output, here we +only change its width, add and arrow and alter the ticks: By default, ticks are +stroked only towards the inside of the graph (in the path examples there is no +graph but don't mind). The labels and the axis title are plotted outside of the +graph. Futhermore, the axis title (when present as in this example) is rotated +along the axis (without writing it upside down), while the tick labels are not +rotated at all. In this example we set an `outerticklength`. Together with the `innerticklength` set to the same value by default the ticks are stroked across the axis. As it is common to subcomponents of the axis, you need to pass the adapted instances (stored in the variable `mypainter` here) to the axis in its constructor. + Modified: trunk/pyx/examples/axis/parter.txt ===================================================================  trunk/pyx/examples/axis/parter.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/parter.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,19 +1,23 @@ Manual parters and rational number arithmetics +Parter: Control over the partitioning of the axis Partitioners (in the code the short form `parter` is used all over the place) take care of calculating appropriate tick positions for a given axis range. Automatic partitioners create several tick lists, which are than rated by an axis rater instance afterwards. In contrast manual partitioners create a single tick list only, which thus doesn't need to be rated at all. ... +In the above example, the (default) automatic choice of a good partitioning has +been selected. Here, we show how to gain more control over the ticks, in order +to fix their intervals. ... +Partitioners (in the code the short form `parter` is used) take care of +calculating appropriate tick positions for a given axis range. Automatic +partitioners create several tick lists, which are than rated by an axis rater +instance, as explained in the above example. In contrast, manual partitioners +create a single tick list only, which thus doesn't need to be rated at all. + In this example we create a manual partitioner, which places ticks with a distance of 1/3 and subticks with a distance of 1/6. We than use this partitioner at two axis, which are identical except for a texter instance to +distance of 1/3 and subticks with a distance of 1/6. We then use this +partitioner at two axis, which are identical except for a texter instance (to show you another feature of the axes in PyX, namely the rational number arithmetics used to place ticks. The rational numbers are preserved throughout +arithmetics used to place ticks). The rational numbers are preserved throughout the whole process of merging ticks, until the texter finally needs to output the rational numbers. And at the very end the decimal texter steps into the problem to create a proper representation for the frations. The solution is +problem to create a proper representation for the fractions. The solution is shown at the left part of the example: the texter marks a period to express the fraction. Modified: trunk/pyx/examples/axis/rating.txt ===================================================================  trunk/pyx/examples/axis/rating.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/rating.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,15 +1,17 @@ Rating of axis partitionings +Rater: How a nicely looking axis partition is chosen In this example several axes with the same parameters are plotted on a path scaled at 3 different sizes. Note that the axes adjust the ticks appropriately to the available space. For that a `partitioner` (the short form `parter` is used in the code) creates several possible solutions for placing ticks and labels at the axis. ... +We here demonstrate how an axis actually chooses its partition. ... However, we do not address this partioning feature here (we just use the default), but we show you the rating facilities instead. Still, we don't modify the defaults either, but we want to discuss certain features of this system. +There are goodlooking partitions of an axis and badlooking ones. The element +which chooses one or the other, is the `rater` of an axis. It asks yet another +element, the `parter` to suggest several partitions and then chooses the best, +according to criteria such as tick distance, number of ticks, subticks, etc. +(The partitioning process itself is explained in a later example). +In this example we show the influence of the tick distances: Several axes with +the same parameters are plotted on a path which is scaled. Note that the axes +choose the ticks appropriately to the available space. + The rating mechanism takes into account the number of ticks and subticks, but also the distances between the labels. Thus, the example in the middle has less ticks than the right version, because there is more space available at the @@ 22,10 +24,10 @@ reconfiguring the whole rating mechanism, simple adjustments to favour more or less ticks are easily possible by the axis keyword argument `density`. !! In this example the same axis instance is used several times. This works +!! In this example, the same axis instance is used several times. This works since the axis does not store any data within its own instance. Instead, an `anchoredaxis` instance is created by the `pathaxis` which embbeds the axis in a proper environment. Among others a place for storing information for this specific use of the axis instance is provided that way. When using axes in a graph the graph instance takes care of the proper setup of the anchored axes instances. +`anchoredaxis` instance is created by the `pathaxis` which embeds the axis in a +proper environment. This way, a place for storing information for this specific +use of the axis instance is provided. When using axes in a graph, the graph +instance takes care of the proper setup of the anchored axes instances. + Modified: trunk/pyx/examples/axis/texter.py ===================================================================  trunk/pyx/examples/axis/texter.py 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/texter.py 20080326 15:36:37 UTC (rev 2977) @@ 2,20 +2,24 @@ from pyx import * from pyx.graph import axis +texter1 = axis.texter.decimal(plus="+", minus="", equalprecision=1) +texter2 = axis.texter.rational() + class piaxis(axis.linear): def __init__(self, divisor=math.pi, texter=axis.texter.rational(suffix="\pi"), **kwargs): axis.linear.__init__(self, divisor=divisor, texter=texter, **kwargs) +p1 = path.path(path.moveto(0, 0), path.curveto(3, 0, 1, 4, 4, 4)) +p2 = p1.transformed(trafo.translate(4, 0)) +p3 = p2.transformed(trafo.translate(4, 0)) +p4 = p3.transformed(trafo.translate(4, 0)) p = path.path(path.moveto(0, 0), path.curveto(3, 0, 1, 4, 4, 4))  c = canvas.canvas() c.insert(axis.pathaxis(p, axis.linear(min=0, max=10))) c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0)),  axis.linear(min=0, max=1e5))) c.insert(axis.pathaxis(p.transformed(trafo.translate(8, 0)),  piaxis(min=0, max=2*math.pi))) +c.insert(axis.pathaxis(p1, axis.linear(min=0, max=1e2))) +c.insert(axis.pathaxis(p2, axis.linear(min=0.7, max=0.4, texter=texter1))) +c.insert(axis.pathaxis(p3, axis.linear(min=0.7, max=0.4, texter=texter2))) +c.insert(axis.pathaxis(p4, piaxis(min=0, max=2*math.pi))) c.writeEPSfile("texter") c.writePDFfile("texter") Modified: trunk/pyx/examples/axis/texter.txt ===================================================================  trunk/pyx/examples/axis/texter.txt 20080326 13:54:51 UTC (rev 2976) +++ trunk/pyx/examples/axis/texter.txt 20080326 15:36:37 UTC (rev 2977) @@ 1,11 +1,22 @@ Texter +Texter: Controlling the formatting of tick labels Texters create the label strings written to the ticks. There are texters available for decimal numbers without and with an exponential part as well as fractions. ... +Texters do the formatting of the tick labels: They create the strings which are +then passed to the painter. You can choose between fractions and decimal +numbers with/without an exponential part. ... The `texter` should not be mixed +up with the `painter`: The `painter` is afterwards doing the TeXing and finally +creates the labels  the `texter` prepares the string that is to be processed +by TeX. ! At the right axis we also show how to create a special piaxis. Here some axis parameters are altered to fit an piscaled axis nicely. Futhermore instead of just creating a special axis instance by setting the divisor and texter parameters, a `piaxis` class is created which just alters the defaults of the linear axis it is based at. +The first example shows the default behavior, which chooses either decimal and +exponential formatting. + +The second example is for special purpose only (because it is ugly), in case +that it is strictly necessary to have the same width of all labels. + +The third example shows how to create fractions instead of decimal numbers. + +! At the rightmost axis we also show how to create a special piaxis. Here, some +axis parameters are altered to fit an piscaled axis nicely. Futhermore, +instead of just creating a special axis instance by setting the divisor and +texter parameters, a `piaxis` class is created which just alters the defaults +of the linear axis it is based at. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 
From: <joergl@us...>  20080326 16:06:55

Revision: 2980 http://pyx.svn.sourceforge.net/pyx/?rev=2980&view=rev Author: joergl Date: 20080326 09:06:58 0700 (Wed, 26 Mar 2008) Log Message:  improve axis descriptions a little bit more Modified Paths:  trunk/pyx/examples/axis/link.txt trunk/pyx/examples/axis/log.txt trunk/pyx/examples/axis/minimal.txt trunk/pyx/examples/axis/painter.txt Modified: trunk/pyx/examples/axis/link.txt ===================================================================  trunk/pyx/examples/axis/link.txt 20080326 15:50:24 UTC (rev 2979) +++ trunk/pyx/examples/axis/link.txt 20080326 16:06:58 UTC (rev 2980) @@ 14,6 +14,6 @@ Note that for a linked axis, PyX automatically turns off the drawing of the axis labels, as you can see in the upper panel. If you do not like this behaviour, you have to pass a different axis painter to the `\xB4linkedaxis` constructor. +have to pass a different axis painter to the `linkedaxis` constructor. Modified: trunk/pyx/examples/axis/log.txt ===================================================================  trunk/pyx/examples/axis/log.txt 20080326 15:50:24 UTC (rev 2979) +++ trunk/pyx/examples/axis/log.txt 20080326 16:06:58 UTC (rev 2980) @@ 7,7 +7,9 @@ of the ticks  the rater just alters some defaults in favour of using more subticks to improve the visualization of the logarithmic nature of the axis. ! Beside presenting a standard logarithmic axis we also show you how to alter +! Besides presenting a standard logarithmic axis, we also show you how to alter the base used by the logarithmic axis. Since the functionality of a logarithmic axis is independend of the base, all we need to adjust are certain components creating ticks, the texts for the labels etc. +axis is independent of the base, all we need to adjust are the components for +creating ticks (see `log2parter`) and the texts for the labels (see +`log2texter`). More details about the parters and texters components are given +below in the corresponding examples. Modified: trunk/pyx/examples/axis/minimal.txt ===================================================================  trunk/pyx/examples/axis/minimal.txt 20080326 15:50:24 UTC (rev 2979) +++ trunk/pyx/examples/axis/minimal.txt 20080326 16:06:58 UTC (rev 2980) @@ 5,8 +5,7 @@ `pathaxis` from the `graph.axis` module takes a path and returns a canvas which contains the drawn axis. Differently than in the typical usecase of graphs containing data, we must here provide the range explicitly (`min` and `max` arguments). graphs the range of an axis gets adjusted automatically although you can still set minimal and/or maximal values to force a certain axis range.  +In contrast to the typical usecase of graphs containing data, we here have to +provide the range explicitly (using the `min` and `max` arguments). For real +graphs the range of an axis, of course, is adjusted automatically, although you +can still set minimal and/or maximal values to force a certain axis range. Modified: trunk/pyx/examples/axis/painter.txt ===================================================================  trunk/pyx/examples/axis/painter.txt 20080326 15:50:24 UTC (rev 2979) +++ trunk/pyx/examples/axis/painter.txt 20080326 16:06:58 UTC (rev 2980) @@ 5,7 +5,7 @@ painter. You can modify these attributes by creating a painter explicitly. ... While the axis painter has quite some parameters to adjust the output, here we only change its width, add and arrow and alter the ticks: By default, ticks are +only change its width, add an arrow and alter the ticks: By default, ticks are stroked only towards the inside of the graph (in the path examples there is no graph but don't mind). The labels and the axis title are plotted outside of the graph. Futhermore, the axis title (when present as in this example) is rotated @@ 13,8 +13,7 @@ rotated at all. In this example we set an `outerticklength`. Together with the `innerticklength` set to the same value by default the ticks are stroked across the axis. As it is common to subcomponents of the axis, you need to pass the adapted instances (stored in the variable `mypainter` here) to the axis in its constructor.  +`innerticklength`, which by default is set to the same value, the ticks are +stroked across the axis. As it is common to subcomponents of the axis, you +need to pass the adapted instances (stored in the variable `mypainter` here) to +the axis in its constructor. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. 