From 1f5279c7ea91c3a6dc5d647e400fd3964f012019 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Thu, 19 Dec 2013 22:53:17 +0000 Subject: [PATCH] remove the gallery, it is now a wiki at https://sourceforge.net/p/pyx/gallery git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx@3574 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- gallery/INDEX | 3 -- gallery/Makefile | 1 - gallery/README | 15 ------- gallery/graphs/INDEX | 10 ----- gallery/graphs/README | 1 - gallery/graphs/arrows.py | 23 ---------- gallery/graphs/cycliclink.py | 20 --------- gallery/graphs/inset.py | 10 ----- gallery/graphs/integral.py | 30 ------------- gallery/graphs/manyaxes.py | 21 --------- gallery/graphs/partialfill.py | 38 ---------------- gallery/graphs/piaxis.py | 17 ------- gallery/graphs/shift.dat | 101 ------------------------------------------ gallery/graphs/shift.py | 17 ------- gallery/graphs/symbolline.py | 37 ---------------- gallery/graphs/washboard.py | 38 ---------------- gallery/misc/INDEX | 6 --- gallery/misc/box.py | 20 --------- gallery/misc/connect.py | 26 ----------- gallery/misc/julia.py | 42 ------------------ gallery/misc/pattern.py | 9 ---- gallery/misc/pyxpyx.py | 12 ----- gallery/misc/vector.py | 27 ----------- gallery/path/INDEX | 5 --- gallery/path/README | 1 - gallery/path/circles.py | 20 --------- gallery/path/knot.py | 63 -------------------------- gallery/path/knot.txt | 18 -------- gallery/path/sierpinski.py | 27 ----------- gallery/path/springs.py | 27 ----------- gallery/path/springs.txt | 20 --------- gallery/path/tree.py | 33 -------------- 32 files changed, 738 deletions(-) delete mode 100644 gallery/INDEX delete mode 120000 gallery/Makefile delete mode 100644 gallery/README delete mode 100644 gallery/graphs/INDEX delete mode 100644 gallery/graphs/README delete mode 100644 gallery/graphs/arrows.py delete mode 100644 gallery/graphs/cycliclink.py delete mode 100644 gallery/graphs/inset.py delete mode 100644 gallery/graphs/integral.py delete mode 100644 gallery/graphs/manyaxes.py delete mode 100644 gallery/graphs/partialfill.py delete mode 100644 gallery/graphs/piaxis.py delete mode 100644 gallery/graphs/shift.dat delete mode 100644 gallery/graphs/shift.py delete mode 100644 gallery/graphs/symbolline.py delete mode 100644 gallery/graphs/washboard.py delete mode 100644 gallery/misc/INDEX delete mode 100644 gallery/misc/box.py delete mode 100644 gallery/misc/connect.py delete mode 100644 gallery/misc/julia.py delete mode 100644 gallery/misc/pattern.py delete mode 100644 gallery/misc/pyxpyx.py delete mode 100644 gallery/misc/vector.py delete mode 100644 gallery/path/INDEX delete mode 100644 gallery/path/README delete mode 100644 gallery/path/circles.py delete mode 100644 gallery/path/knot.py delete mode 100644 gallery/path/knot.txt delete mode 100644 gallery/path/sierpinski.py delete mode 100644 gallery/path/springs.py delete mode 100644 gallery/path/springs.txt delete mode 100644 gallery/path/tree.py diff --git a/gallery/INDEX b/gallery/INDEX deleted file mode 100644 index eecf3cf5..00000000 --- a/gallery/INDEX +++ /dev/null @@ -1,3 +0,0 @@ -path/ -graphs/ -misc/ diff --git a/gallery/Makefile b/gallery/Makefile deleted file mode 120000 index 094b6ac5..00000000 --- a/gallery/Makefile +++ /dev/null @@ -1 +0,0 @@ -../examples/Makefile \ No newline at end of file diff --git a/gallery/README b/gallery/README deleted file mode 100644 index 330f38e9..00000000 --- a/gallery/README +++ /dev/null @@ -1,15 +0,0 @@ -PyX gallery - -Similar to the PyX example pages the gallery shows you some ready-to-run PyX -code. But whereas the examples try to provide you minimal examples to explain -various features of PyX, in the gallery, we show you some fancy and/or real world -examples. While sometimes you will find some explanations similar to those of -the example pages, a full description of all the details is far out of scope -for the gallery. Still, the shown code might be well suited as a starting point -for your own experiments with PyX. - -We encourage you to submit suitable gallery examples via the [PyX mailing lists -http://sourceforge.net/mail/?group_id=45430]. In case the example needs -external data, please try to use a single external data file only. Optionally, -you can include a short description on the specifics of the example, e.g., what -cool feature of PyX it makes use of. diff --git a/gallery/graphs/INDEX b/gallery/graphs/INDEX deleted file mode 100644 index 85f02834..00000000 --- a/gallery/graphs/INDEX +++ /dev/null @@ -1,10 +0,0 @@ -symbolline -inset -cycliclink -arrows -shift -piaxis -manyaxes -integral -partialfill -washboard diff --git a/gallery/graphs/README b/gallery/graphs/README deleted file mode 100644 index 8f03c197..00000000 --- a/gallery/graphs/README +++ /dev/null @@ -1 +0,0 @@ -Graphs diff --git a/gallery/graphs/arrows.py b/gallery/graphs/arrows.py deleted file mode 100644 index afa50452..00000000 --- a/gallery/graphs/arrows.py +++ /dev/null @@ -1,23 +0,0 @@ -from math import pi, atan2 -from pyx import * - -z1 = 2.5 + 4.5j -z2 = 7.5 + 5.5j - -# we abuse a parametric function below, so we express everything in terms of a parameter k -x = lambda k: int(k)/11 -y = lambda k: int(k)%11 -z = lambda k: x(k) + y(k) * 1j -f = lambda k: 1/(z(k)-z1)/(z(k)-z2) # function to be plotted -s = lambda k: 5*abs(f(k)) # magnitude of function value -a = lambda k: 180/pi*atan2(f(k).imag, f(k).real) # direction of function value - -g = graph.graphxy(width=8, - x=graph.axis.linear(min=0, max=10), - y=graph.axis.linear(min=0, max=10)) -g.plot(graph.data.paramfunction("k", 0, 120, - "x, y, size, angle = x(k), y(k), s(k), a(k)", - points=121, context=locals()),# access extern - [graph.style.arrow()]) # variables&functions -g.writeEPSfile("arrows") # by passing a context -g.writePDFfile("arrows") # by passing a context diff --git a/gallery/graphs/cycliclink.py b/gallery/graphs/cycliclink.py deleted file mode 100644 index df82c1a8..00000000 --- a/gallery/graphs/cycliclink.py +++ /dev/null @@ -1,20 +0,0 @@ -from pyx import * - -c = canvas.canvas() - -g1 = c.insert(graph.graphxy(width=8, - x=graph.axis.linear(min=0, max=1), - x2=graph.axis.linkedaxis())) - -g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5, - x=graph.axis.linkedaxis(), - x2=graph.axis.log(min=1, max=1000))) - -g1.axes["x2"].setlinkedaxis(g2.axes["x2"]) -g2.axes["x"].setlinkedaxis(g1.axes["x"]) - -g1.plot(graph.data.function("y(x)=2*exp(-30*x)-exp(-3*x)")) -g2.plot(graph.data.function("y(x)=cos(20*x)*exp(-2*x)")) - -c.writeEPSfile("cycliclink") -c.writePDFfile("cycliclink") diff --git a/gallery/graphs/inset.py b/gallery/graphs/inset.py deleted file mode 100644 index 02117488..00000000 --- a/gallery/graphs/inset.py +++ /dev/null @@ -1,10 +0,0 @@ -from pyx import * - -g = graph.graphxy(width=8, x=graph.axis.linear(min=-2, max=2)) -g.plot(graph.data.function("y(x)=exp(x)")) -g2 = g.insert(graph.graphxy(width=3.5, xpos=1, ypos=2, - x=graph.axis.linear(min=0, max=3), - y=graph.axis.linear(min=-2, max=2))) -g2.plot(graph.data.function("y(x)=log(x)")) -g.writeEPSfile("inset") -g.writePDFfile("inset") diff --git a/gallery/graphs/integral.py b/gallery/graphs/integral.py deleted file mode 100644 index f50c9bc6..00000000 --- a/gallery/graphs/integral.py +++ /dev/null @@ -1,30 +0,0 @@ -from pyx import * - -a, b = 2, 9 # integral area - -p = graph.axis.painter.regular(basepathattrs=[deco.earrow.normal], - titlepos=0.98, titledirection=None) -ticks = [graph.axis.tick.tick(a, label="$a$"), - graph.axis.tick.tick(b, label="$b$")] -g = graph.graphxy(width=8, x2=None, y2=None, - x=graph.axis.linear(title="$x$", min=0, max=10, - manualticks=ticks, - parter=None, painter=p), - y=graph.axis.linear(title="$y$", parter=None, painter=p)) -d = g.plot(graph.data.function("y(x)=(x-3)*(x-5)*(x-7)")) -g.finish() -p = d.path # the path is available after the graph is finished - -pa = g.xgridpath(a) -pb = g.xgridpath(b) -(splita,), (splitpa,) = p.intersect(pa) -(splitb,), (splitpb,) = p.intersect(pb) -area = (pa.split([splitpa])[0] << - p.split([splita, splitb])[1] << - pb.split([splitpb])[0].reversed()) -area[-1].close() -g.stroke(area, [deco.filled([color.gray(0.8)])]) -g.text(g.pos(0.5 * (a + b), 0)[0], 1, - r"\int_a^b f(x){\rm d}x", [text.halign.center, text.mathmode]) -g.writeEPSfile("integral") -g.writePDFfile("integral") diff --git a/gallery/graphs/manyaxes.py b/gallery/graphs/manyaxes.py deleted file mode 100644 index d939651f..00000000 --- a/gallery/graphs/manyaxes.py +++ /dev/null @@ -1,21 +0,0 @@ -import math, random -from pyx import * - -# a xy-graph has linear x and y axes by default -# they might be overwritten and futher axes might be added as well -g = graph.graphxy(width=8, y=graph.axis.log(), y2=graph.axis.lin(), - y3=graph.axis.lin(min=0, max=1), - y4=graph.axis.lin(min=0, max=2)) - -# we generate some data and a function with multiple arguments -d = [[i, math.exp(0.8*i+random.random())] for i in range(1,10)] -f = lambda x, a: x*a - -g.plot(graph.data.points(d, x=1, y=2)) -g.plot(graph.data.function("y2(x)=f(x, 1)", context=locals())) - -g.plot(graph.data.function("x(y3)=5+sin(2*pi*y3)")) -g.plot(graph.data.function("x(y4)=5+sin(2*pi*y4)")) - -g.writeEPSfile("manyaxes") -g.writePDFfile("manyaxes") diff --git a/gallery/graphs/partialfill.py b/gallery/graphs/partialfill.py deleted file mode 100644 index 48aceb31..00000000 --- a/gallery/graphs/partialfill.py +++ /dev/null @@ -1,38 +0,0 @@ -# contributed by Michael Schindler - -from pyx import * - -# get the lines from the graph -xax = graph.axis.linear(min=-1, max=1.0, painter=None) -yax = graph.axis.linear(min=-1.3, max=1.3, painter=None) -g = graph.graphxy(width=10, ratio=2, x=xax, y=yax) -pifline = g.plot(graph.data.function("y(x)=sin(1.0/(x**2+0.02122))", points=1000)) -pihoriz = g.plot(graph.data.function("y(x)=0.5*x", points=2)) -g.finish() - -# fetch path from info returned by plot method of graph -fline = pifline.path -horiz = pihoriz.path - -# intersect the lines -splith, splitf = horiz.intersect(fline) - -# create gray area (we do not use simple clipping) -area = horiz.split([splith[0]])[0] -for i in range(0, len(splith)-2, 2): - area = area.joined(fline.split([splitf[i], splitf[i+1]])[1]) - area = area.joined(horiz.split([splith[i+1], splith[i+2]])[1]) -area = area.joined(fline.split([splitf[-2], splitf[-1]])[1]) -area = area.joined(horiz.split([splith[-1]])[1]) -area.append(path.lineto(*g.vpos(1, 0))) -area.append(path.lineto(*g.vpos(0, 0))) -area.append(path.closepath()) # not really needed (filling closes automatically) - -c = canvas.canvas() - -# draw first the area, then the function -c.fill(area, [color.gray(0.6)]) -c.stroke(fline, [style.linewidth.Thick, style.linejoin.round]) - -c.writeEPSfile("partialfill") -c.writePDFfile("partialfill") diff --git a/gallery/graphs/piaxis.py b/gallery/graphs/piaxis.py deleted file mode 100644 index abb06f9a..00000000 --- a/gallery/graphs/piaxis.py +++ /dev/null @@ -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") diff --git a/gallery/graphs/shift.dat b/gallery/graphs/shift.dat deleted file mode 100644 index b9b4936c..00000000 --- a/gallery/graphs/shift.dat +++ /dev/null @@ -1,101 +0,0 @@ -0.000000 0.093552 0.112454 0.179711 -0.010000 0.010819 0.375696 0.409862 -0.020000 0.185630 0.475497 0.459045 -0.030000 0.085790 0.739999 0.705008 -0.040000 0.048823 0.916421 0.983903 -0.050000 0.175599 0.738313 0.721993 -0.060000 0.133378 0.663194 0.637172 -0.070000 0.017070 0.462168 0.432542 -0.080000 0.142286 0.159476 0.076606 -0.090000 0.175035 0.115659 0.168348 -0.100000 0.065532 0.021641 0.099089 -0.110000 0.338032 0.193684 0.075735 -0.120000 0.501449 0.076071 0.052825 -0.130000 0.714484 0.166160 0.260115 -0.140000 1.044950 0.140046 0.113768 -0.150000 0.761459 0.150199 0.091245 -0.160000 0.580124 0.124991 0.148302 -0.170000 0.366523 0.034990 0.015023 -0.180000 0.086310 0.050342 0.193373 -0.190000 0.183720 0.008756 0.065295 -0.200000 0.148604 0.101561 0.106499 -0.210000 0.129528 0.124659 0.194451 -0.220000 0.111310 0.055354 0.137575 -0.230000 0.240304 0.379149 0.310891 -0.240000 0.197671 0.570959 0.479726 -0.250000 0.026784 0.927620 0.902845 -0.260000 0.133537 0.837585 0.858621 -0.270000 0.043651 1.314035 1.465999 -0.280000 0.198483 1.147673 1.166429 -0.290000 0.127190 0.826202 0.748380 -0.300000 0.131359 0.899580 0.940880 -0.310000 0.119633 0.853252 1.219305 -0.320000 0.148364 0.947769 0.845000 -0.330000 0.319962 0.915448 0.716717 -0.340000 0.593264 0.944451 0.787436 -0.350000 0.875959 1.011230 0.490365 -0.360000 0.856434 0.974125 1.161382 -0.370000 1.371431 0.833430 1.640708 -0.380000 1.090264 0.974813 1.526268 -0.390000 0.783328 0.874536 1.527830 -0.400000 0.976016 0.834380 1.833305 -0.410000 1.240585 1.281413 1.710859 -0.420000 0.735648 0.721365 1.712504 -0.430000 0.694313 0.818321 2.118110 -0.440000 0.771420 0.895332 2.568452 -0.450000 0.464567 0.486208 2.164012 -0.460000 1.028716 1.102470 2.585583 -0.470000 1.666251 1.619384 2.008516 -0.480000 1.482772 1.569979 2.424176 -0.490000 1.526710 1.705879 2.563430 -0.500000 1.681632 1.801579 2.115234 -0.510000 1.648768 1.642538 2.155867 -0.520000 1.640045 1.727319 1.835203 -0.530000 2.129760 2.166372 2.190385 -0.540000 2.538762 2.484445 2.062762 -0.550000 2.128357 2.044120 2.186967 -0.560000 2.563771 2.594849 2.466537 -0.570000 2.091981 2.043196 2.652307 -0.580000 2.319331 2.286016 2.363267 -0.590000 2.546574 2.428293 2.150611 -0.600000 2.241166 2.136176 1.720958 -0.610000 2.153191 2.125280 1.762141 -0.620000 1.762225 1.700132 1.668114 -0.630000 2.302032 2.162618 1.833917 -0.640000 1.944317 1.915787 1.659345 -0.650000 2.126381 2.070251 1.763199 -0.660000 2.405465 2.399447 1.790405 -0.670000 2.776870 2.651151 1.777731 -0.680000 2.328131 2.327470 1.752451 -0.690000 2.142656 2.184793 1.666516 -0.700000 1.702775 1.824695 1.739324 -0.710000 1.793138 1.759536 1.733953 -0.720000 1.280445 1.282639 1.412333 -0.730000 1.085254 1.004976 1.001700 -0.740000 1.584523 1.442157 1.462368 -0.750000 1.033501 1.146581 1.149616 -0.760000 1.172442 1.247916 1.239193 -0.770000 1.438631 1.435911 1.545370 -0.780000 1.802119 1.814190 1.911582 -0.790000 1.623176 1.739982 1.722814 -0.800000 1.321928 1.461423 1.430906 -0.810000 1.073016 1.112029 1.209466 -0.820000 1.273442 1.268402 1.137061 -0.830000 1.075054 1.157114 1.099937 -0.840000 1.377204 1.322320 1.241025 -0.850000 1.675064 1.688645 1.833905 -0.860000 1.566260 1.594175 1.556601 -0.870000 1.487966 1.619798 1.564591 -0.880000 1.420821 1.433038 1.360169 -0.890000 1.052967 1.016814 0.967521 -0.900000 0.731004 0.864763 0.770634 -0.910000 0.698500 0.622465 0.677814 -0.920000 1.022049 1.009725 0.936713 -0.930000 0.981331 0.900933 0.995858 -0.940000 1.314244 1.215228 1.250874 -0.950000 1.138328 1.243438 1.282548 -0.960000 0.817129 0.827435 0.791566 -0.970000 0.681887 0.575078 0.606345 -0.980000 0.577195 0.553300 0.538145 -0.990000 0.212586 0.223119 0.296213 -1.000000 0.141721 0.087720 0.002712 diff --git a/gallery/graphs/shift.py b/gallery/graphs/shift.py deleted file mode 100644 index 57aea151..00000000 --- a/gallery/graphs/shift.py +++ /dev/null @@ -1,17 +0,0 @@ -# You can manually set the subaxes and exceed the axes ranges. -# The width of the regular axes can be modified by a size paramater. -# While most axes do not have a size parameter, it can be added to -# any existing axis very easily. For linear axes so called sizedlinear -# and autosizedlinear axes are defined by PyX already. - -from pyx import * - -subaxes = [graph.axis.linear(max=1), - graph.axis.linear(max=1), - graph.axis.sizedlinear(size=3, min=0, max=3)] - -g = graph.graphxy(width=8, y=graph.axis.split(subaxes=subaxes)) -g.plot([graph.data.file("shift.dat", x=1, y="i, $(i+2)", context={"i": i}) - for i in range(3)], [graph.style.line()]) -g.writeEPSfile("shift") -g.writePDFfile("shift") diff --git a/gallery/graphs/symbolline.py b/gallery/graphs/symbolline.py deleted file mode 100644 index 5baea71d..00000000 --- a/gallery/graphs/symbolline.py +++ /dev/null @@ -1,37 +0,0 @@ -# contributed by Francisco Borges - -from pyx import * -from pyx.graph import graphxy, data, axis -from pyx.graph.axis import painter, tick -from pyx.deco import earrow - -range = 2.5 - -p = painter.regular(basepathattrs=[earrow.normal], titlepos=0.95, - outerticklength=painter.ticklength.normal, - titledist=-0.3, titledirection=None) # horizontal text - -g = graphxy(width=10, xaxisat=0, yaxisat=0, - x=axis.linear(title="$x$", min=-range, max=+range, painter=p, - # suppress some ticks by overwriting ... - manualticks=[tick.tick(0, None, None), - tick.tick(range, None, None)]), - y=axis.linear(title=r"$x\sin(x^2)$", painter=p, - manualticks=[tick.tick(0, None, None), - tick.tick(3, None, None)])) - -g.plot(data.function("y(x)=x*sin(x**2)"), - # Line style is set before symbol style -> symbols will be draw - # above the line. - [graph.style.line([style.linewidth.Thin, style.linestyle.solid]), - graph.style.symbol(graph.style.symbol.circle, size=0.1, - symbolattrs=[deco.filled([color.rgb.green]), - deco.stroked([color.rgb.red])])]) - -# manually typeset "0" near the origin -g.dolayout() -x0, y0 = g.pos(0, 0) -g.text(x0 - 0.2, y0 - 0.2, "0", [text.halign.right, text.valign.top]) - -g.writeEPSfile("symbolline") -g.writePDFfile("symbolline") diff --git a/gallery/graphs/washboard.py b/gallery/graphs/washboard.py deleted file mode 100644 index 2002d77e..00000000 --- a/gallery/graphs/washboard.py +++ /dev/null @@ -1,38 +0,0 @@ -# contributed by Sigmund Kohler - -from math import pi, cos -from pyx import * -from pyx.deco import barrow, earrow -from pyx.style import linewidth, linestyle -from pyx.graph import graphxy -from pyx.graph.axis import linear -from pyx.graph.axis.painter import regular -from pyx.graph.style import line -from pyx.graph.data import function - -mypainter = regular(basepathattrs=[earrow.normal], titlepos=1) -def mycos(x): return -cos(x)+.10*x - -g = graphxy(height=5, x2=None, y2=None, - x=linear(min=-2.5*pi, max=3.3*pi, parter=None, - painter=mypainter, title=r"$\delta\phi$"), - y=linear(min=-2.3, max=2, painter=None)) -g.plot(function("y(x)=mycos(x)", context=locals()), - [line(lineattrs=[linewidth.Thick])]) -g.finish() - -x1, y1 = g.pos(-pi+.1, mycos(-pi+.1)) -x2, y2 = g.pos(-.1, mycos(-.1)) -x3, y3 = g.pos(pi+.1, mycos(pi+.1)) - -g.stroke(path.line(x1-.5, y1, x1+.5, y1), [linestyle.dashed]) -g.stroke(path.line(x1-.5, y3, x3+.5, y3), [linestyle.dashed]) -g.stroke(path.line(x2-.5, y2, x3+.5, y2), [linestyle.dashed]) -g.stroke(path.line(x1, y1, x1, y3), [barrow.normal, earrow.normal]) -g.stroke(path.line(x3, y2, x3, y3), [barrow.normal, earrow.normal]) -g.text(x1+.2, 0.5*(y1+y3), r"$2\pi\gamma k\Omega$", [text.vshift.middlezero]) -g.text(x1-.6, y1-.1, r"$E_{\rm b}$", [text.halign.right]) -g.text(x3+.15, y2+.20, r"$2J_k(\varepsilon/\Omega)+\pi\gamma k\Omega$") - -g.writeEPSfile("washboard") -g.writePDFfile("washboard") diff --git a/gallery/misc/INDEX b/gallery/misc/INDEX deleted file mode 100644 index e3f07eca..00000000 --- a/gallery/misc/INDEX +++ /dev/null @@ -1,6 +0,0 @@ -pattern -pyxpyx -vector -connect -box -julia diff --git a/gallery/misc/box.py b/gallery/misc/box.py deleted file mode 100644 index 854045e3..00000000 --- a/gallery/misc/box.py +++ /dev/null @@ -1,20 +0,0 @@ -from math import sin, cos, pi -from pyx import * - -r = 1.5 - -# create a box list of regular polygons -boxes = [box.polygon([(-r*sin(i*2*pi/n), r*cos(i*2*pi/n)) - for i in range(n)]) - for n in range(3, 8)] -# tile with spacing 0 horizontally -box.tile(boxes, 0, 1, 0) - -c = canvas.canvas() -for b in boxes: - # plot the boxes path - c.stroke(b.path(), [color.rgb.green]) - # a second time with bezier rounded corners - c.stroke(b.path(), [deformer.smoothed(radius=0.5), color.rgb.red]) -c.writeEPSfile("box") -c.writePDFfile("box") diff --git a/gallery/misc/connect.py b/gallery/misc/connect.py deleted file mode 100644 index 6729738c..00000000 --- a/gallery/misc/connect.py +++ /dev/null @@ -1,26 +0,0 @@ -from pyx import * -from pyx.connector import arc, curve - -unit.set(uscale=3) - -c = canvas.canvas() - -textattrs = [text.halign.center, text.vshift.middlezero] -A = text.text(0, 0, r"\bf A", textattrs) -B = text.text(1, 0, r"\bf B", textattrs) -C = text.text(1, 1, r"\bf C", textattrs) -D = text.text(0, 1, r"\bf D", textattrs) - -for X in [A, B, C, D]: - c.draw(X.bbox().enlarged(0.1).path(), - [deco.stroked(), deco.filled([color.grey(0.85)])]) - c.insert(X) - -for X,Y in [[A, B], [B, C], [C, D], [D, A]]: - c.stroke(arc(X, Y, boxdists=[0.2, 0.2], relangle=-45), [color.rgb.red, deco.earrow.normal]) - -c.stroke(curve(D, B, boxdists=[0.2, 0.2], relangle1=-45, relangle2=-45, relbulge=0.8), - [color.rgb.blue, deco.earrow.normal]) - -c.writeEPSfile("connect") -c.writePDFfile("connect") diff --git a/gallery/misc/julia.py b/gallery/misc/julia.py deleted file mode 100644 index 94a3ec76..00000000 --- a/gallery/misc/julia.py +++ /dev/null @@ -1,42 +0,0 @@ -# contributed by Stefan Schenk - -from io import BytesIO -from math import sqrt -from pyx import * - -xiterations = yiterations = 250 -Min_Im = -1.5 -Max_Im = 1.5 -Min_Re = -1.5 -Max_Re = 1.5 -c = 0.41 + 0.3j -p = color.gradient.RedBlue - -def rgbcolortostring(c): - return bytes([int(255*c.r), int(255*c.g), int(255*c.b)]) - -data = BytesIO() - -# compute fractal -for y in range(yiterations): - for x in range(xiterations): - z = complex(1.0*(Max_Re-Min_Re)*x/xiterations + Min_Re, - 1.0*(Max_Im-Min_Im)*y/yiterations + Min_Im) - - for k in range(256): - z = z*z + c - if abs(z) > 2: - # append color(RGB) of the current pixel to the end of data - data.write(rgbcolortostring(p.getcolor(1.0/sqrt(k+1)))) - break - else: - data.write(b"\0\0\0") - -# generate image from data -julia = bitmap.image(xiterations, yiterations, "RGB", data.getvalue()) -juliabitmap = bitmap.bitmap(0, 0, julia, height=10) - -c = canvas.canvas() -c.insert(juliabitmap) -c.writeEPSfile("julia") -c.writePDFfile("julia") diff --git a/gallery/misc/pattern.py b/gallery/misc/pattern.py deleted file mode 100644 index 665b87e1..00000000 --- a/gallery/misc/pattern.py +++ /dev/null @@ -1,9 +0,0 @@ -from pyx import * - -p = pattern.pattern() -p.text(0, 0, r"\PyX") - -c = canvas.canvas() -c.text(0, 0, r"\PyX", [trafo.scale(25), p]) -c.writeEPSfile("pattern") -c.writePDFfile("pattern") diff --git a/gallery/misc/pyxpyx.py b/gallery/misc/pyxpyx.py deleted file mode 100644 index 1091c0a2..00000000 --- a/gallery/misc/pyxpyx.py +++ /dev/null @@ -1,12 +0,0 @@ -from pyx import * - -textpath = text.text(0, 0, r"\PyX").textpath().reversed() -decotext = r"\PyX{} is fun! "*50 -scale = text.text(0, 0, decotext).width/textpath.arclen() - -c = canvas.canvas() -c.draw(textpath, [trafo.scale(scale), - deco.filled([color.gray(0.5)]), - deco.curvedtext(decotext)]) -c.writeEPSfile("pyxpyx") -c.writePDFfile("pyxpyx") diff --git a/gallery/misc/vector.py b/gallery/misc/vector.py deleted file mode 100644 index f2ed05c3..00000000 --- a/gallery/misc/vector.py +++ /dev/null @@ -1,27 +0,0 @@ -from math import pi, sin, cos -from pyx import * - -def vector(x1, y1, x2, y2, t, pos=0.5, distance=0.1): - c = canvas.canvas() - c.stroke(path.line(x1, y1, x2, y2), [deco.earrow.normal]) - textbox = text.text((1-pos)*x1 + pos*x2, (1-pos)*y1 + pos*y2, t, - [text.halign.center, text.vshift.mathaxis]) - if distance < 0: - textbox.linealign(-distance, y1 - y2, x2 - x1) - else: - textbox.linealign(distance, y2 - y1, x1 - x2) - c.insert(textbox) - return c - -r = 1.5 -a = 150 - -c = canvas.canvas() -dx, dy = cos(a * pi / 180), sin(a * pi / 180) -x, y = r * dx, r * dy -c.stroke(path.circle(0, 0, r)) -c.insert(vector(0, 0, x, y, r"$\vec r$")) -c.insert(vector(x, y, x - dy, y + dx, r"$\vec t$", pos=0.7)) -c.insert(vector(x, y, x + dx, y + dy, r"$\vec n$", pos=0.7)) -c.writeEPSfile("vector") -c.writePDFfile("vector") diff --git a/gallery/path/INDEX b/gallery/path/INDEX deleted file mode 100644 index 997429dd..00000000 --- a/gallery/path/INDEX +++ /dev/null @@ -1,5 +0,0 @@ -circles -springs -knot -sierpinski -tree diff --git a/gallery/path/README b/gallery/path/README deleted file mode 100644 index 55301f0e..00000000 --- a/gallery/path/README +++ /dev/null @@ -1 +0,0 @@ -Paths diff --git a/gallery/path/circles.py b/gallery/path/circles.py deleted file mode 100644 index 0929530c..00000000 --- a/gallery/path/circles.py +++ /dev/null @@ -1,20 +0,0 @@ -from pyx import * - -circ1 = path.circle(0, 0, 1.5) -circ2 = path.circle(1, 1, 1) -(circ1a, circ1b), (circ2a, circ2b) = circ1.intersect(circ2) -intersection = (circ2.split([circ2b, circ2a])[1] - << circ1.split([circ1a, circ1b])[1]) -intersection[-1].close() - -union = (circ1.split([circ1a, circ1b])[0] - << circ2.split([circ2b, circ2a])[0]) -union[-1].close() - -c = canvas.canvas() -c.fill(union, [color.rgb.blue]) -c.fill(intersection, [color.rgb.red]) -c.stroke(circ1) -c.stroke(circ2) -c.writeEPSfile("circles") -c.writePDFfile("circles") diff --git a/gallery/path/knot.py b/gallery/path/knot.py deleted file mode 100644 index c21c26d5..00000000 --- a/gallery/path/knot.py +++ /dev/null @@ -1,63 +0,0 @@ -from pyx import * -unit.set(uscale=3, wscale=3) - -dist = 0.15 # distance between the ropes -thick = 0.08 # thickness of the ropes - -# build the basepath of the knot. This is the curve that lies -# between both ropes. -A = 1.0, 0.1 # point where the knot starts after the straight line -B = 1.3, 0 # point where the knot is curved, overlying the straight line -t = -0.8, -0.1 # direction at A -s = 0.3, 1.2 # direction at B -pts = [ - ( A[0]-t[0], A[1]-t[1]), ( A[0] , A[1] ), - ( A[0]+t[0], A[1]+t[1]), (-B[0]-s[0],-B[1]-s[1]), - (-B[0] ,-B[1] ), (-B[0]+s[0],-B[1]+s[1]), - ( B[0]-s[0], B[1]-s[1]), ( B[0] , B[1] ), - ( B[0]+s[0], B[1]+s[1]), (-A[0]-t[0],-A[1]-t[1]), - (-A[0] ,-A[1] ), (-A[0]+t[0],-A[1]+t[1]) ] -seam = path.path( - path.moveto(*(pts[0])), - path.lineto(*(pts[1])), - path.curveto(pts[2][0],pts[2][1],pts[3][0],pts[3][1],pts[4][0],pts[4][1]), - path.curveto(pts[5][0],pts[5][1],pts[6][0],pts[6][1],pts[7][0],pts[7][1]), - path.curveto(pts[8][0],pts[8][1],pts[9][0],pts[9][1],pts[10][0],pts[10][1]), - path.lineto(*(pts[11])) ) -# We smooth this curve a little because we used curveto together with lineto -seam = deformer.smoothed(0.6).deform(seam) - -# The ropes, when drawn later, will have to overlap in a very specific way. -l = seam.arclen() -epsilon = 0.002*l # small overlap between the segments -seam_segs = seam.split([0.28*l+epsilon, 0.28*l-epsilon, - 0.42*l+epsilon, 0.42*l-epsilon, - 0.58*l+epsilon, 0.58*l-epsilon, - 0.72*l+epsilon, 0.72*l-epsilon])[::2] - -# For each segment, two shifted paths build the boundaries of each rope -ropes_segs = [] -for seam_seg in seam_segs: - ropes_segs.append([]) - for ropeshift in [-0.5*dist, 0.5*dist]: - ropes_segs[-1].append([]) - for edgeshift in [-0.5*thick, 0.5*thick]: - ropes_segs[-1][-1].append( - deformer.parallel(ropeshift + edgeshift).deform(seam_seg)) -# Now, ropes_segs is a list of segments, containing a list of ropes, -# each containing the two bounding paths of the rope segment - -rope_colors = [color.rgb.blue, color.rgb.red] -c = canvas.canvas() -# Because the segments should overlap in a very specific manner -# we have to draw them in the correct order -for index in [1, 4, 2, 0, 3]: - for rope_seg, col in zip(ropes_segs[index], rope_colors): - seg = rope_seg[0].joined(rope_seg[1].reversed()) - seg.append(path.closepath()) - c.fill(seg, [col]) - c.stroke(rope_seg[0], [style.linecap.round, style.linejoin.round]) - c.stroke(rope_seg[1], [style.linecap.round, style.linejoin.round]) - -c.writeEPSfile("knot") -c.writePDFfile("knot") diff --git a/gallery/path/knot.txt b/gallery/path/knot.txt deleted file mode 100644 index 3aaea3b0..00000000 --- a/gallery/path/knot.txt +++ /dev/null @@ -1,18 +0,0 @@ -Paths with constant distance - -The example shows how to create paths with constant distance. This is achieved -with the aid of `deformer.parallel`, which has already been used in the above -example. ... - -The first part of the example code is only for creating the middle line of the -knot. In order to obtain a nicely curved rope, we smooth the such defined curve -a bit. - -The individual parts of the knot must be stroked in a very specific way in -order to achieve the correct overlapping of the knot. To this end, we split the -base curve into five pieces. - -The key element of the example is the use of `deformer.parallel` which creates -the curves with constant distance from the base curve. We apply the deformer -four times, thus creating the outline path of two individual ropes, which -parallel follow the shape of the knot. diff --git a/gallery/path/sierpinski.py b/gallery/path/sierpinski.py deleted file mode 100644 index 38a17757..00000000 --- a/gallery/path/sierpinski.py +++ /dev/null @@ -1,27 +0,0 @@ -# Sierpinski triangle -# contributed by Gerhard Schmid - -from math import sqrt -from pyx import * - -# triangle geometry -l = 10 -h = 0.5 * sqrt(3) * l - -# base triangle path -p = path.path(path.moveto(0, 0), - path.lineto(l, 0), - path.lineto(0.5 * l, h), - path.closepath()) - -for i in range(6): - # path is scaled down ... - p = p.transformed(trafo.scale(0.5)) - # ... and three times plotted (translated accordingly) - p += ( p.transformed(trafo.translate(0.5 * l, 0)) + - p.transformed(trafo.translate(0.25 * l, 0.5 * h))) - -c = canvas.canvas() -c.stroke(p, [style.linewidth.Thin]) -c.writeEPSfile("sierpinski") -c.writePDFfile("sierpinski") diff --git a/gallery/path/springs.py b/gallery/path/springs.py deleted file mode 100644 index 379c7db8..00000000 --- a/gallery/path/springs.py +++ /dev/null @@ -1,27 +0,0 @@ -# contributed by Gert-Ludwig Ingold - -from pyx import * - -n = 3 # number of masses -r = 3.0 # system radius -rcyc = 0.3 # radius of cycloid -nl = 13 # number of loops -rc = 0.5 # radius of masses -eps = 0.03 # extra spacing for surrounding circles - -c = canvas.canvas() -springcircle = path.circle(0, 0, r) -masspositions = [i*springcircle.arclen()/n - for i in range(n)] -for springsegment in springcircle.split(masspositions): - c.stroke(springsegment, - [deformer.cycloid(rcyc, nl), - deformer.smoothed(radius=0.1)]) -for x, y in springcircle.at(masspositions): - c.fill(path.circle(x, y, rc)) - -c.stroke(springcircle, [deformer.parallel(rc+eps)]) -c.stroke(springcircle, [deformer.parallel(-rc-eps)]) - -c.writeEPSfile("springs") -c.writePDFfile("springs") diff --git a/gallery/path/springs.txt b/gallery/path/springs.txt deleted file mode 100644 index 936a4975..00000000 --- a/gallery/path/springs.txt +++ /dev/null @@ -1,20 +0,0 @@ -Deforming paths - -In this example, another type of stroke attributes is demonstrated, namely the -`deformers`. They take an original curve and return a modified one. Here, the -first deformer bends three arcs into spirals, the next one smooths the result -a bit. ... - -In the example code, a circle is first created and then split into three -segments. Each segment of the arc is then stroked with `deformer.cycloid` and -`deformer.smoothed`, which create the spring-like look of the segments. The -cycloid does not start at the very beginning of the original path. Instead, it -first follows the original path for a certain length and then starts, yielding -a sharp corner. This corner is smoothed a bit by the second deformer. - -! Note that the order of the deformer attributes is not arbitrary, since the -deforming operations do not commute. - -The two circles surrounding the springs are not created as simple circles but -rather as the curves with constant distance to the original circle. This -demonstrates the use of a third deformer, namely `deformer.parallel`. diff --git a/gallery/path/tree.py b/gallery/path/tree.py deleted file mode 100644 index 21f21638..00000000 --- a/gallery/path/tree.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# fractal tree -# contributed by Gerhard Schmid and André Wobst - -from pyx import * - -# base tree length -l = 5 - -# base transformations for the left, center, and right part of the tree -ltrafo = trafo.rotate(65).scaled(0.4).translated(0, l * 2.0 / 3.0) -ctrafo = trafo.rotate(-4).scaled(0.75).translated(0, l) -rtrafo = trafo.mirror(90).rotated(-65).scaled(0.35).translated(0, l) - -def tree(depth): - "return transformations for a recursive tree of given depth" - r = [trafo.rotate(5)] - if depth > 0: - subtree = tree(depth - 1) - r.extend([t*ltrafo for t in subtree]) - r.extend([t*ctrafo for t in subtree]) - r.extend([t*rtrafo for t in subtree]) - return r - -c = canvas.canvas() -for t in tree(7): - # apply the transformation to a "sub"-canvas and insert it into the "main" canvas - c.insert(canvas.canvas([t])).stroke(path.line(0, 0, 0, l)) - # note that there is a difference when only transforming the line as in: - # c.stroke(path.line(0, 0, 0, l), [t]) - # The difference is, that the linewidth would not be scaled down. -c.writeEPSfile("tree") -c.writePDFfile("tree") -- 2.11.4.GIT