Skip to content

Commit

Permalink
finally, this is huge: SVG support
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx@3627 a4f5e268-e194-4f32-bce1-d30804cbbcc5
  • Loading branch information
wobsta committed Apr 29, 2015
1 parent 78220b0 commit 8424c8d
Show file tree
Hide file tree
Showing 110 changed files with 1,698 additions and 36 deletions.
1 change: 1 addition & 0 deletions examples/3dgraphs/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
[graph.style.barpos(fromvalue=0, frompathattrs=None), graph.style.bar(barattrs=[style.linejoin.bevel])])
g.writeEPSfile("bar")
g.writePDFfile("bar")
g.writeSVGfile("bar")
1 change: 1 addition & 0 deletions examples/3dgraphs/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
backcolor=color.rgb.black)])
g.writeEPSfile("color")
g.writePDFfile("color")
g.writeSVGfile("color")
1 change: 1 addition & 0 deletions examples/3dgraphs/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
g.plot(graph.data.file("grid.dat", x=1, y=2, z=3), [graph.style.grid()])
g.writeEPSfile("grid")
g.writePDFfile("grid")
g.writeSVGfile("grid")
1 change: 1 addition & 0 deletions examples/3dgraphs/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
g.plot(graph.data.file("surface.dat", x=1, y=2, z=3), [graph.style.surface()])
g.writeEPSfile("surface")
g.writePDFfile("surface")
g.writeSVGfile("surface")
4 changes: 4 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ all:
make $(ipynbfiles)
make $(thumbpngfiles)

all_without_remove:
make $(ipynbfiles)
make $(thumbpngfiles)

%.eps: %.py
cd $(dir $^); PYTHONPATH=$(CURDIR)/.. $(PYTHON) -W default $(notdir $^)

Expand Down
1 change: 1 addition & 0 deletions examples/axis/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@

g.writeEPSfile()
g.writePDFfile()
g.writeSVGfile()
1 change: 1 addition & 0 deletions examples/axis/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@

c.writeEPSfile("link")
c.writePDFfile("link")
c.writeSVGfile("link")
1 change: 1 addition & 0 deletions examples/axis/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

g.writeEPSfile("log")
g.writePDFfile("log")
g.writeSVGfile("log")
1 change: 1 addition & 0 deletions examples/axis/manualticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
c.insert(graph.axis.pathaxis(p2, graph.axis.linear(min=0, max=10, manualticks=myticks)))
c.writeEPSfile("manualticks")
c.writePDFfile("manualticks")
c.writeSVGfile("manualticks")
1 change: 1 addition & 0 deletions examples/axis/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
graph.axis.linear(min=0, max=10))
c.writeEPSfile("minimal")
c.writePDFfile("minimal")
c.writeSVGfile("minimal")
1 change: 1 addition & 0 deletions examples/axis/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
graph.axis.linear(min=0, max=11, title="axis title", painter=mypainter))
c.writeEPSfile("painter")
c.writePDFfile("painter")
c.writeSVGfile("painter")
1 change: 1 addition & 0 deletions examples/axis/parter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
texter=graph.axis.texter.rational())))
c.writeEPSfile("parter")
c.writePDFfile("parter")
c.writeSVGfile("parter")
1 change: 1 addition & 0 deletions examples/axis/rating.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
c.insert(graph.axis.pathaxis(p3, myaxis))
c.writeEPSfile("rating")
c.writePDFfile("rating")
c.writeSVGfile("rating")
1 change: 1 addition & 0 deletions examples/axis/texter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ def __init__(self, divisor=math.pi,
c.insert(axis.pathaxis(p4, piaxis(min=0, max=2*math.pi)))
c.writeEPSfile("texter")
c.writePDFfile("texter")
c.writeSVGfile("texter")
1 change: 1 addition & 0 deletions examples/bargraphs/changebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
g.plot(graph.data.file("minimal.dat", xname=0, y=2), [graph.style.changebar()])
g.writeEPSfile("changebar")
g.writePDFfile("changebar")
g.writeSVGfile("changebar")
1 change: 1 addition & 0 deletions examples/bargraphs/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
[graph.style.bar()])
g.writeEPSfile("compare")
g.writePDFfile("compare")
g.writeSVGfile("compare")
1 change: 1 addition & 0 deletions examples/bargraphs/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
graph.style.errorbar()])
g.writeEPSfile("errors")
g.writePDFfile("errors")
g.writeSVGfile("errors")
1 change: 1 addition & 0 deletions examples/bargraphs/fromvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
[graph.style.barpos(fromvalue=0), graph.style.bar()])
g.writeEPSfile("fromvalue")
g.writePDFfile("fromvalue")
g.writeSVGfile("fromvalue")
1 change: 1 addition & 0 deletions examples/bargraphs/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
g.plot(graph.data.file("minimal.dat", xname=0, y=2), [graph.style.bar()])
g.writeEPSfile("minimal")
g.writePDFfile("minimal")
g.writeSVGfile("minimal")
1 change: 1 addition & 0 deletions examples/bargraphs/month.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
g.plot(graph.data.file("minimal.dat", xname=1, y=2), [graph.style.bar()])
g.writeEPSfile("month")
g.writePDFfile("month")
g.writeSVGfile("month")
1 change: 1 addition & 0 deletions examples/bargraphs/stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
graph.style.text("stack")])
g.writeEPSfile("stacked")
g.writePDFfile("stacked")
g.writeSVGfile("stacked")
1 change: 1 addition & 0 deletions examples/bitmap/jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
c.insert(bitmap.bitmap(0, 0, i, compressmode=None))
c.writeEPSfile("jpeg")
c.writePDFfile("jpeg")
c.writeSVGfile("jpeg")
1 change: 1 addition & 0 deletions examples/bitmap/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
c.insert(bitmap_rgb)
c.writeEPSfile("minimal")
c.writePDFfile("minimal")
c.writeSVGfile("minimal")
1 change: 1 addition & 0 deletions examples/bitmap/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
c.insert(bitmap.bitmap(0, 0, im, height=0.8))
c.writeEPSfile("pil")
c.writePDFfile("pil")
c.writeSVGfile("pil")
1 change: 1 addition & 0 deletions examples/drawing/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
deco.filled([color.rgb.green])], size=1)])
c.writeEPSfile("arrow")
c.writePDFfile("arrow")
c.writeSVGfile("arrow")
1 change: 1 addition & 0 deletions examples/drawing/metapost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

c.writeEPSfile("metapost")
c.writePDFfile("metapost")
c.writeSVGfile("metapost")
1 change: 1 addition & 0 deletions examples/drawing/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
c.fill(path.circle(2.5, 1.5, 0.5))
c.writeEPSfile("path")
c.writePDFfile("path")
c.writeSVGfile("path")
1 change: 1 addition & 0 deletions examples/drawing/pathitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

c.writeEPSfile("pathitem")
c.writePDFfile("pathitem")
c.writeSVGfile("pathitem")
1 change: 1 addition & 0 deletions examples/drawing/strokefill.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
deco.filled([color.rgb.green])])
c.writeEPSfile("strokefill")
c.writePDFfile("strokefill")
c.writeSVGfile("strokefill")
1 change: 1 addition & 0 deletions examples/drawing/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
c.fill(path.rect(0, -3, 4, 1), [color.rgb.blue])
c.writeEPSfile("style")
c.writePDFfile("style")
c.writeSVGfile("style")
1 change: 1 addition & 0 deletions examples/drawing2/clipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

c.writeEPSfile("clipping")
c.writePDFfile("clipping")
c.writeSVGfile("clipping")
1 change: 1 addition & 0 deletions examples/drawing2/ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@

c.writeEPSfile("ellipse")
c.writePDFfile("ellipse")
c.writeSVGfile("ellipse")
1 change: 1 addition & 0 deletions examples/drawing2/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
c.insert(cc, [trafo.rotate(i*angle), trafo.scale(factor**i)])
c.writeEPSfile("insert")
c.writePDFfile("insert")
c.writeSVGfile("insert")
1 change: 1 addition & 0 deletions examples/drawing2/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
c.stroke(p, [deformer.parallel(-0.2), color.rgb.red])
c.writeEPSfile("parallel")
c.writePDFfile("parallel")
c.writeSVGfile("parallel")
1 change: 1 addition & 0 deletions examples/drawing2/smoothed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
c.stroke(p, [deformer.smoothed(2.0), color.rgb.red])
c.writeEPSfile("smoothed")
c.writePDFfile("smoothed")
c.writeSVGfile("smoothed")
1 change: 1 addition & 0 deletions examples/graphs/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
g.plot(graph.data.function("y(x)=tan(log(1/x))**2"))
g.writeEPSfile("axis")
g.writePDFfile("axis")
g.writeSVGfile("axis")
1 change: 1 addition & 0 deletions examples/graphs/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
[graph.style.line([color.gradient.Rainbow])])
g.writeEPSfile("change")
g.writePDFfile("change")
g.writeSVGfile("change")
1 change: 1 addition & 0 deletions examples/graphs/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
g.plot(graph.data.function("y(x)=sin(x)/x", min=-15, max=15))
g.writeEPSfile("function")
g.writePDFfile("function")
g.writeSVGfile("function")
1 change: 1 addition & 0 deletions examples/graphs/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

g.writeEPSfile()
g.writePDFfile()
g.writeSVGfile()
1 change: 1 addition & 0 deletions examples/graphs/lissajous.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
g.plot(graph.data.paramfunction("k", 0, 2*pi, "x, y = sin(2*k), cos(3*k)"))
g.writeEPSfile("lissajous")
g.writePDFfile("lissajous")
g.writeSVGfile("lissajous")
1 change: 1 addition & 0 deletions examples/graphs/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
g.plot(graph.data.file("minimal.dat", x=1, y=2))
g.writeEPSfile("minimal")
g.writePDFfile("minimal")
g.writeSVGfile("minimal")
2 changes: 1 addition & 1 deletion examples/graphs/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
g.plot(graph.data.points(list(zip(list(range(10)), list(range(10)))), x=1, y=2))
g.writeEPSfile("points")
g.writePDFfile("points")

g.writeSVGfile("points")
1 change: 1 addition & 0 deletions examples/graphstyles/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ def drawpoint(self, privatedata, sharedata, graph, point):
c.text(gcbb.center()[0], gcbb.bottom()-0.5, r"\dots")
c.writeEPSfile("cal")
c.writePDFfile("cal")
c.writeSVGfile("cal")
1 change: 1 addition & 0 deletions examples/graphstyles/changesymbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ def drawpoint(self, privatedata, sharedata, graph, point):
[changesymbol()])
g.writeEPSfile("changesymbol")
g.writePDFfile("changesymbol")
g.writeSVGfile("changesymbol")
1 change: 1 addition & 0 deletions examples/graphstyles/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
[graph.style.density(gradient=color.rgbgradient.Rainbow)])
g.writeEPSfile()
g.writePDFfile()
g.writeSVGfile()
1 change: 1 addition & 0 deletions examples/graphstyles/errorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
[graph.style.symbol(), graph.style.errorbar()])
g.writeEPSfile("errorbar")
g.writePDFfile("errorbar")
g.writeSVGfile("errorbar")
1 change: 1 addition & 0 deletions examples/graphstyles/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
g.plot(d, [graph.style.histogram()])
g.writeEPSfile("histogram")
g.writePDFfile("histogram")
g.writeSVGfile("histogram")
1 change: 1 addition & 0 deletions examples/graphstyles/usesymbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
styles=[line, symbol])
g.writeEPSfile("usesymbol")
g.writePDFfile("usesymbol")
g.writeSVGfile("usesymbol")
1 change: 1 addition & 0 deletions examples/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
c.stroke(path.line(0, 0, 2, 0))
c.writeEPSfile()
c.writePDFfile()
c.writeSVGfile()
1 change: 1 addition & 0 deletions examples/path/addjoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@

c.writeEPSfile("addjoin")
c.writePDFfile("addjoin")
c.writeSVGfile("addjoin")
1 change: 1 addition & 0 deletions examples/path/arclen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@

c.writeEPSfile("arclen")
c.writePDFfile("arclen")
c.writeSVGfile("arclen")
1 change: 1 addition & 0 deletions examples/path/at.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ def mark(x, y):

c.writeEPSfile("at")
c.writePDFfile("at")
c.writeSVGfile("at")
1 change: 1 addition & 0 deletions examples/path/intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
c.stroke(p2, [color.rgb.green])
c.writeEPSfile("intersect")
c.writePDFfile("intersect")
c.writeSVGfile("intersect")
1 change: 1 addition & 0 deletions examples/path/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
c.stroke(p2, [style.linewidth.Thick, color.rgb.green])
c.writeEPSfile("split")
c.writePDFfile("split")
c.writeSVGfile("split")
1 change: 1 addition & 0 deletions examples/splitgraphs/minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
((1, 109), 0.9)], x=1, y=2))
g.writeEPSfile("minimal")
g.writePDFfile("minimal")
g.writeSVGfile("minimal")
1 change: 1 addition & 0 deletions examples/splitgraphs/splitatvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
points=1000))
g.writeEPSfile("splitatvalue")
g.writePDFfile("splitatvalue")
g.writeSVGfile("splitatvalue")
1 change: 1 addition & 0 deletions examples/text/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
c.stroke(path.rect(-0.2, -0.2, 6.2, 0.6), [col])
c.writeEPSfile("color")
c.writePDFfile("color")
c.writeSVGfile("color")
1 change: 1 addition & 0 deletions examples/text/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
c.text(0, 0, r"\LaTeX{} doesn't need to look like \LaTeX{} all the time.")
c.writeEPSfile("font")
c.writePDFfile("font")
c.writeSVGfile("font")
1 change: 1 addition & 0 deletions examples/text/halign.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@

c.writeEPSfile("halign")
c.writePDFfile("halign")
c.writeSVGfile("halign")
1 change: 1 addition & 0 deletions examples/text/marker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
c.stroke(path.line(center[0], center[1]-1, center[0], center[1]+1), [color.rgb.red])
c.writeEPSfile("marker")
c.writePDFfile("marker")
c.writeSVGfile("marker")
1 change: 1 addition & 0 deletions examples/text/texrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

c.writeEPSfile("texrunner")
c.writePDFfile("texrunner")
c.writeSVGfile("texrunner")
1 change: 1 addition & 0 deletions examples/text/textalongpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

c.writeEPSfile("textalongpath")
c.writePDFfile("textalongpath")
c.writeSVGfile("textalongpath")
1 change: 1 addition & 0 deletions examples/text/textbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
c.insert(tbox)
c.writeEPSfile("textbox")
c.writePDFfile("textbox")
c.writeSVGfile("textbox")
1 change: 1 addition & 0 deletions examples/text/valign.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@

c.writeEPSfile("valign")
c.writePDFfile("valign")
c.writeSVGfile("valign")
2 changes: 1 addition & 1 deletion pyx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
del sys

__all__ = ["attr", "box", "bitmap", "canvas", "color", "connector", "deco", "deformer", "document",
"epsfile", "graph", "mesh", "metapost", "path", "pattern", "pdfextra", "style", "trafo", "text", "unit"]
"epsfile", "svgfile", "graph", "mesh", "metapost", "path", "pattern", "pdfextra", "style", "trafo", "text", "unit"]

import importlib

Expand Down
Loading

0 comments on commit 8424c8d

Please sign in to comment.