diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-02-21 18:08:55 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-02-21 18:08:55 -0800 |
commit | b24f282bca4af63982937c10835063d3e6e9eb74 (patch) | |
tree | fd8c58601beb3964ccecf4709f7b28944fc1c36b /examples/graphstyles/usesymbol.jl | |
parent | 84572be10cdfc852530787a5dc78ddef3e0f23cd (diff) | |
download | PyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.tar.gz PyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.zip |
add many, many more example conversions. still not complete
Diffstat (limited to 'examples/graphstyles/usesymbol.jl')
-rw-r--r-- | examples/graphstyles/usesymbol.jl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/graphstyles/usesymbol.jl b/examples/graphstyles/usesymbol.jl new file mode 100644 index 0000000..af49f99 --- /dev/null +++ b/examples/graphstyles/usesymbol.jl @@ -0,0 +1,41 @@ + +# Original Python: +# from pyx import * +# +# # colors and symbols to use (alternatingly) +# colors = [color.rgb.red, color.rgb.green, color.rgb.blue, color.gray.black] +# symbols = [graph.style._diamondsymbol, graph.style._trianglesymbol, graph.style._circlesymbol] +# +# # create the graph styles to be used below +# symbol = graph.style.symbol(symbol=attr.changelist(symbols), +# symbolattrs=[deco.stroked.clear, +# attr.changelist([deco.filled([cc]) for cc in colors])]) +# line = graph.style.line(lineattrs=[attr.changelist(colors), +# attr.changelist([style.linestyle.solid])]) +# +# g = graph.graphxy(width=8, x=graph.axis.linear(min=0, max=1)) +# g.plot([graph.data.function("y(x) = x**%d" % i, points=8) for i in range(1, 7)], +# styles=[line, symbol]) +# g.writeEPSfile("usesymbol") +# g.writePDFfile("usesymbol") +# g.writeSVGfile("usesymbol") + +using PyX + +# colors and symbols to use (alternatingly) +colors = [color_rgb.red, color_rgb.green, color_rgb.blue, color_gray.black] +symbols = [graph_style._diamondsymbol, graph_style._trianglesymbol, graph_style._circlesymbol] + +# create the graph styles to be used below +symbol = graph_style.symbol(symbol=attr.changelist(symbols), + symbolattrs=[deco_stroked.clear, + attr.changelist([deco.filled([cc]) for cc in colors])]) +line = graph_style.line(lineattrs=[attr.changelist(colors), + attr.changelist([style_linestyle.solid])]) + +g = graph.graphxy(width=8, x=graph_axis.linear(min=0, max=1)) +plot(g, [graph_data_function("y(x) = x**$i", points=8) for i in 1:7], + styles=[line, symbol]) +writeEPSfile(g, "usesymbol") +writePDFfile(g, "usesymbol") + |