more examples

This commit is contained in:
Vitor Santos Costa 2012-11-27 13:50:18 +00:00
parent e529e79582
commit 683032432c
2 changed files with 30 additions and 4 deletions

View File

@ -3,6 +3,13 @@
:- initialization(main). :- initialization(main).
setup_dir :-
prolog_load_context(directory, Dir),
atom_concat(Dir,'/pyx/',Base),
assert(base(Base)).
:- setup_dir.
main :- main :-
ex(X), ex(X),
flush_output, flush_output,
@ -10,8 +17,15 @@ main :-
main. main.
ex(hello_world) :- ex(hello_world) :-
c = pyx:canvas:canvas, c := pyx:canvas:canvas,
:= c:text(0, 0, 'Hello, world!'), := $c:text(0, 0, 'Hello, world!'),
:= c:stroke(path:line(0, 0, 2, 0)), := $c:stroke(path:line(0, 0, 2, 0)),
c.writePDFfile('hello.pdf'). := $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).

View File

@ -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