diff --git a/packages/python/examples/pyx.pl b/packages/python/examples/pyx.pl index 0df87f002..b28e5b49f 100644 --- a/packages/python/examples/pyx.pl +++ b/packages/python/examples/pyx.pl @@ -3,6 +3,13 @@ :- initialization(main). +setup_dir :- + prolog_load_context(directory, Dir), + atom_concat(Dir,'/pyx/',Base), + assert(base(Base)). + +:- setup_dir. + main :- ex(X), flush_output, @@ -10,8 +17,15 @@ main :- main. ex(hello_world) :- - c = pyx:canvas:canvas, - := c:text(0, 0, 'Hello, world!'), - := c:stroke(path:line(0, 0, 2, 0)), - c.writePDFfile('hello.pdf'). + c := pyx:canvas:canvas, + := $c:text(0, 0, 'Hello, world!'), + := $c:stroke(path:line(0, 0, 2, 0)), + := $c:writePDFfile('hello'). + +ex(changebar) :- + g := pyx:graph:graphxy(width=8, x=graph:axis:bar), + atomic_concat(Source, 'minimal.dat', Data), + := $g:plot(graph:data:file(Data, xname=0, y=2), [graph:style:changebar]), + := $g:writePDFfile(changebar). + diff --git a/packages/python/examples/pyx/minimal.dat b/packages/python/examples/pyx/minimal.dat new file mode 100644 index 000000000..d7b89a344 --- /dev/null +++ b/packages/python/examples/pyx/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