aboutsummaryrefslogtreecommitdiffstats
path: root/examples/graphs/join.jl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/graphs/join.jl')
-rw-r--r--examples/graphs/join.jl47
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/graphs/join.jl b/examples/graphs/join.jl
new file mode 100644
index 0000000..f33e498
--- /dev/null
+++ b/examples/graphs/join.jl
@@ -0,0 +1,47 @@
+
+# Original Python:
+# from pyx import *
+#
+# g = graph.graphxy(width=8, key=graph.key.key())
+#
+# As = [0.3, 0.6, 0.9]
+#
+# d = [graph.data.join([graph.data.function("y_a(x_a)=A*sin(2*pi*x_a)", context=dict(A=A)),
+# graph.data.file("join.dat", x_b=1, y_b=i+2)],
+# title=r"$A=%g$" % A)
+# for i, A in enumerate(As)]
+#
+# attrs = [color.gradient.RedBlue]
+#
+# g.plot(d,
+# [graph.style.pos(usenames=dict(x="x_a", y="y_a")),
+# graph.style.line(attrs),
+# graph.style.pos(usenames=dict(x="x_b", y="y_b")),
+# graph.style.symbol(graph.style.symbol.changesquare, symbolattrs=attrs, size=0.1)])
+#
+# g.writeEPSfile()
+# g.writePDFfile()
+# g.writeSVGfile()
+
+using PyX
+
+g = graph.graphxy(width=8, key=graph_key.key())
+
+As = [0.3, 0.6, 0.9]
+
+d = [graph_data.join([graph_data_function("y_a(x_a)=A*sin(2*pi*x_a)", context=Dict("A"=>A)),
+ graph_data.file("examples/graphs/join.dat", x_b=1, y_b=i+1)],
+ title=latexstring("\$A=$A\$"))
+ for (i, A) in enumerate(As)]
+
+attrs = [color_gradient.RedBlue]
+
+plot(g, d,
+ [graph_style.pos(usenames=Dict("x"=>"x_a", "y"=>"y_a")),
+ graph_style.line(attrs),
+ graph_style.pos(usenames=Dict("x"=>"x_b", "y"=>"y_b")),
+ graph_style.symbol(graph_style_symbol.changesquare, symbolattrs=attrs, size=0.1)])
+
+writeEPSfile(g, "join")
+writePDFfile(g, "join")
+