aboutsummaryrefslogtreecommitdiffstats
path: root/examples/bargraphs
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-02-21 18:08:55 -0800
committerbnewbold <bnewbold@robocracy.org>2016-02-21 18:08:55 -0800
commitb24f282bca4af63982937c10835063d3e6e9eb74 (patch)
treefd8c58601beb3964ccecf4709f7b28944fc1c36b /examples/bargraphs
parent84572be10cdfc852530787a5dc78ddef3e0f23cd (diff)
downloadPyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.tar.gz
PyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.zip
add many, many more example conversions. still not complete
Diffstat (limited to 'examples/bargraphs')
-rw-r--r--examples/bargraphs/changebar.jl17
-rw-r--r--examples/bargraphs/compare.jl22
-rw-r--r--examples/bargraphs/errors.jl35
-rw-r--r--examples/bargraphs/fromvalue.jl19
-rw-r--r--examples/bargraphs/minimal.dat12
-rw-r--r--examples/bargraphs/minimal.jl15
-rw-r--r--examples/bargraphs/month.jl27
-rw-r--r--examples/bargraphs/stacked.jl27
8 files changed, 174 insertions, 0 deletions
diff --git a/examples/bargraphs/changebar.jl b/examples/bargraphs/changebar.jl
new file mode 100644
index 0000000..cbb68aa
--- /dev/null
+++ b/examples/bargraphs/changebar.jl
@@ -0,0 +1,17 @@
+
+# Original Python:
+
+# from pyx import *
+
+# g = graph.graphxy(width=8, x=graph.axis.bar())
+# g.plot(graph.data.file("minimal.dat", xname=0, y=2), [graph.style.changebar()])
+# g.writeEPSfile("changebar")
+# g.writePDFfile("changebar")
+# g.writeSVGfile("changebar")
+
+using PyX
+
+g = graph.graphxy(width=8, x=graph_axis.bar())
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=0, y=2), [graph_style.changebar()])
+writeEPSfile(g, "changebar")
+writePDFfile(g, "changebar")
diff --git a/examples/bargraphs/compare.jl b/examples/bargraphs/compare.jl
new file mode 100644
index 0000000..b2a43e3
--- /dev/null
+++ b/examples/bargraphs/compare.jl
@@ -0,0 +1,22 @@
+
+# Original Python:
+
+# from pyx import *
+
+# g = graph.graphxy(width=8, x=graph.axis.nestedbar())
+# g.plot([graph.data.file("minimal.dat", xname="$0, 0", y=2),
+# graph.data.file("minimal.dat", xname="$0, 1", y=3)],
+# [graph.style.bar()])
+# g.writeEPSfile("compare")
+# g.writePDFfile("compare")
+# g.writeSVGfile("compare")
+
+using PyX
+using LaTeXStrings
+
+g = graph.graphxy(width=8, x=graph_axis.nestedbar())
+plot(g, [graph_data.file("examples/bargraphs/minimal.dat", xname=L"$0, 0", y=2),
+ graph_data.file("examples/bargraphs/minimal.dat", xname=L"$0, 1", y=3)],
+ [graph_style.bar()])
+writeEPSfile(g, "compare")
+writePDFfile(g, "compare")
diff --git a/examples/bargraphs/errors.jl b/examples/bargraphs/errors.jl
new file mode 100644
index 0000000..da22081
--- /dev/null
+++ b/examples/bargraphs/errors.jl
@@ -0,0 +1,35 @@
+
+# Original Python:
+
+# from random import random
+# from pyx import *
+
+# g = graph.graphxy(width=8, x=graph.axis.bar())
+# g.plot(graph.data.file("minimal.dat", xname=0, y=2, stack=3,
+# dy="1+random()", dstack="1+random()",
+# context={"random": random}),
+# [graph.style.errorbar(),
+# graph.style.stackedbarpos("stack"),
+# graph.style.bar([color.rgb.green]),
+# graph.style.range({"y": "stack"}),
+# graph.style.errorbar()])
+# g.writeEPSfile("errors")
+# g.writePDFfile("errors")
+# g.writeSVGfile("errors")
+
+using PyX
+
+using PyCall
+@pyimport random
+
+g = graph.graphxy(width=8, x=graph_axis.bar())
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=0, y=2, stack=3,
+ dy="1+random()", dstack="1+random()",
+ context=Dict("random"=>random.random)),
+ [graph_style.errorbar(),
+ graph_style.stackedbarpos("stack"),
+ graph_style.bar([color_rgb.green]),
+ graph_style.range(Dict("y"=>"stack")),
+ graph_style.errorbar()])
+writeEPSfile(g, "errors")
+writePDFfile(g, "errors")
diff --git a/examples/bargraphs/fromvalue.jl b/examples/bargraphs/fromvalue.jl
new file mode 100644
index 0000000..0b8e72e
--- /dev/null
+++ b/examples/bargraphs/fromvalue.jl
@@ -0,0 +1,19 @@
+
+# Original Python:
+
+# from pyx import *
+
+# g = graph.graphxy(width=8, x=graph.axis.bar())
+# g.plot(graph.data.file("minimal.dat", xname=0, y=2),
+# [graph.style.barpos(fromvalue=0), graph.style.bar()])
+# g.writeEPSfile("fromvalue")
+# g.writePDFfile("fromvalue")
+# g.writeSVGfile("fromvalue")
+
+using PyX
+
+g = graph.graphxy(width=8, x=graph_axis.bar())
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=0, y=2),
+ [graph_style.barpos(fromvalue=0), graph_style.bar()])
+writeEPSfile(g, "fromvalue")
+writePDFfile(g, "fromvalue")
diff --git a/examples/bargraphs/minimal.dat b/examples/bargraphs/minimal.dat
new file mode 100644
index 0000000..d7b89a3
--- /dev/null
+++ b/examples/bargraphs/minimal.dat
@@ -0,0 +1,12 @@
+January -5 1
+Feburary -4 3
+March 0 8
+April 3 13
+May 7 18
+June 10 21
+July 12 23
+August 12 23
+September 8 19
+October 4 13
+November 0 6
+December -4 2
diff --git a/examples/bargraphs/minimal.jl b/examples/bargraphs/minimal.jl
new file mode 100644
index 0000000..54683c1
--- /dev/null
+++ b/examples/bargraphs/minimal.jl
@@ -0,0 +1,15 @@
+
+# Original Python:
+
+# from pyx import *
+
+# g = graph.graphxy(width=8, x=graph.axis.bar())
+# g.plot(graph.data.file("minimal.dat", xname=0, y=2), [graph.style.bar()])
+# g.writeEPSfile("minimal")
+# g.writePDFfile("minimal")
+# g.writeSVGfile("minimal")
+
+g = graph.graphxy(width=8, x=graph_axis.bar())
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=0, y=2), [graph_style.bar()])
+writeEPSfile(g, "bar_minimal")
+writePDFfile(g, "bar_minimal")
diff --git a/examples/bargraphs/month.jl b/examples/bargraphs/month.jl
new file mode 100644
index 0000000..8f5b49d
--- /dev/null
+++ b/examples/bargraphs/month.jl
@@ -0,0 +1,27 @@
+
+# Original Python:
+
+# from pyx import *
+
+# mypainter = graph.axis.painter.bar(nameattrs=[trafo.rotate(45),
+# text.halign.right],
+# innerticklength=0.1)
+# myaxis = graph.axis.bar(painter=mypainter)
+
+# g = graph.graphxy(width=8, x=myaxis)
+# g.plot(graph.data.file("minimal.dat", xname=1, y=2), [graph.style.bar()])
+# g.writeEPSfile("month")
+# g.writePDFfile("month")
+# g.writeSVGfile("month")
+
+using PyX
+mypainter = graph_axis_painter.bar(nameattrs=[trafo.rotate(45),
+ text_halign.right],
+ innerticklength=0.1)
+myaxis = graph_axis.bar(painter=mypainter)
+
+g = graph.graphxy(width=8, x=myaxis)
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=1, y=2),
+ [graph_style.bar()])
+writeEPSfile(g, "month")
+writePDFfile(g, "month")
diff --git a/examples/bargraphs/stacked.jl b/examples/bargraphs/stacked.jl
new file mode 100644
index 0000000..a069b76
--- /dev/null
+++ b/examples/bargraphs/stacked.jl
@@ -0,0 +1,27 @@
+
+# Original Python:
+
+# from pyx import *
+
+# g = graph.graphxy(width=14, height=6, x=graph.axis.bar())
+# g.plot(graph.data.file("minimal.dat", xname=0, y=2, stack=3),
+# [graph.style.bar(),
+# graph.style.text("y"),
+# graph.style.stackedbarpos("stack"),
+# graph.style.bar([color.rgb.green]),
+# graph.style.text("stack")])
+# g.writeEPSfile("stacked")
+# g.writePDFfile("stacked")
+# g.writeSVGfile("stacked")
+
+using PyX
+
+g = graph.graphxy(width=14, height=6, x=graph_axis.bar())
+plot(g, graph_data.file("examples/bargraphs/minimal.dat", xname=0, y=2, stack=3),
+ [graph_style.bar(),
+ graph_style.text("y"),
+ graph_style.stackedbarpos("stack"),
+ graph_style.bar([color_rgb.green]),
+ graph_style.text("stack")])
+writeEPSfile(g, "stacked")
+writePDFfile(g, "stacked")